I've done this numerous times, ranging from high school to college to post-graduate work. Speak from the heart, and give specifics about why that teacher meant so much to you [so he/she can continue to do the things that are meaningful to students].
Without bragging, I can say that I have received many letters from previous students thanking me for what I had done for them. Most have given me specifics about what they liked about my teaching style (not really about me, myself) that I try to incorporate in future teaching situations - and in other realms of my life.
I know from personal experience that your teachers will appreciate hearing from you!!