If you have Microsoft Word, or a similar word processor, there may be a letter template you can use. If you cannot find a suitable template, a simple google search for letter templates will produce many sources where you can locate a letter template.
The template will provide you with the formatting of the letter which can be more important than the actual content as if the letter does not look correct, it may not even get read. Make certain your name and address are on the letter in the appropriate spot, along with the information of the person you are sending it to. Make sure to include the name of the person who did the interview.
Something along the lines of "Thank you Mr. Or Mrs. ____ for offering me a chance to interview. I appreciate the time and consideration you took with regards to my application and the interview." Keep the letter short and relevant, there is no need to waffle.
If you want to include the details of the interview such as the time and date that it occurred to refresh their memory you are more than welcome to do so. You can also state if you learned anything from the interview such as stating you understand why you may not have been the best candidate based on the interview and that they have helped you gain interview experience. You can even ask for suggestions in how to make your interview better for the next time you are given an opportunity.
The request does not really expect an answer, but it shows the interviewer that you were serious about the job that you wish to learn from it, and that you hope they can keep you in mind should a position better suited to you comes along. Keep it short and to the point.