There is a basic structure that you can follow to write a good thank you letter. However the details you should include in the letter depends on what you are writing to thank the reader about.
It also depends on who you are writing the letter to. If it is to a friend or family member, then you will want to use a more casual writing style. However if you are writing to someone that you don't know - or to a colleague, then you will need to use a more formal writing style.
Starting the letter
Start the letter with 'Dear' and then the person who you are writing the letter to. You will have to decide what is the appropriate way of addressing the person, if you need to use first or second name etc.
Writing the letter
Usually thank you letters are quite short so you will want to get straight to the point.
It is important that you put a bit of personality into the letter so it doesn't come across as being generic. Describe a little bit about what you are thankful for and how it it has a affected you. Then say how grateful you are for it.
Closing the letter
To close the letter, again it depends on your relationship with the person you are writing to. In some cases it is only appropriate just to sign your name, but sometimes it is more effective to say something such as 'with love from'.
Before you write your name it might be nice to put 'thanks again.'