How to say “thank you” to a professor who has written a recommendation letter for me?
Don't worry about it too much, just say thank you.  In person or over email are both fine: getting a good recommendation letter is a big deal for you, but writing recommendation letters for good students is a part of normal routine for a professor.