dear ____,
I sincerely apologize for failing your class, I will try to do better next ____, you have taught me a lot, but unfortunately I did not take the knowledge you have given me, to my full extent. I appreciate your time and patience for teaching me valuable lessons. and from now on I will do better. *continue what you want after this*