Dear {Mr./Mrs./Professor Last Name},
I am terribly sorry that I was tardy for {name of class or lecture}. I understand that your time is valuable, as is that of my fellow students, and that {class or lecture} begins at a certain time for a reason.
My time is not more important than anyone else's, so it was inexcusable for me to come in late and disrupt {class or lecture} in the manner in which I did.
Again, I am very sorry for what I did. I hope you know this will not happen again.
Sincerely,
{Sender}