Just a general hint to writing clear English, Fatemah:
You should always try to avoid using more than one conjunction ('and' or 'but') in a sentence. If you find yourself doing so, it's best to start a new sentence instead. (There are times when that rule needn't apply, but your sentence, with three conjunctions in it, isn't one of them).
A shorter, and simpler, version of your email might be better. e.g.
"Dear Professor* [surname],
I apologise that I won't be attending your class today. I wasn't advised of the need to show proof of a negative Covid test until after the test centre had closed for the day. I will, of course, be attending your classes as soon as I've been able to remedy my unfortunate situation.
Regards,
ABC"
*Note: You should only use 'Professor' as a form of address when the relevant person actually holds that title. In which case you should include his/her surname as well. Otherwise you should use the person's correct title (such as Dr Müller) or, in the absence of a specific title, simply 'Herr' or 'Frau' (as you're in Germany), together with the person's surname.