Address the letter formally and professionally to whoever sent you the rejection. Follow all proper letter guidelines, including putting your full address as well as the receiver's full address and date on the top.
Be brief. Thank you letters should not be long and involved. Come straight to the point and thank whoever you are writing for their kind rejection. Thank them for their time in considering your work or project.
Thank the person for any additional information he may have given you, if applicable. Remember that the person who rejected your work did not have to give any reason or input so if you received any, he did so to be helpful. Thank him even if you disagree with his advice.
Finish the letter with a polite request to send more work to them in the future. This is mostly a formality, so do not expect a response. However, it is polite to simply add something like, "I hope to submit to you again in the future." If your rejection already had a request to see more from you, simply add something like, "I hope to work with you in the future" or "I hope to send you more of my work soon."
Sign your letter with your full name. Using "sincerely" is sufficient.