I would like to know how I should address and end my letter I am writing to one of my university teachers.
you can try this:
Dear Professor [Last name]:
(if the teacher is not a professor, then use "Mr." or "Ms")
I am a student in [class name] that you teach.
.......
Sincerely,
your name here.