Thank you, teacher, for guiding me all these years.
Tips
register
Polite, slightly formal - used by juniors to thank seniors who've helped their career, or by speakers describing a mentor relationship. The literal sense (leading a child by the hand) survives in classical or written contexts.