If you would like to apologize for being absent in class, here is a sample template you can use to write an apology letter for not attending class.
To [Recipient Name]
Subject: Apology for not Attending Class
Dear [Recipient Name],
I sincerely apologize for being unable to attend class on [Date] at [Time]. My absence was unavoidable as [Reasons], and I will avoid skipping class in the future.
I will try my best to make up for my absence and gather information from my classmates regarding the subject matter discussed in the class.
I understand that this class was particularly important for my grade, and I accept any subsequent consequences. Kindly accept my apology.
Thank you for your support and consideration.