Writing letters of recommendation is a skill that will be of great importance throughout your teaching career, and should be viewed as an almost integral part of your teaching experience. Students in your classes who have had a positive experience—in terms of what they have learned, or the work they have produced—are likely to come to you for a letter of recommendation. Indeed, an abundance of requests can be taken as an indication that you are a good teacher and have an ability to establish a rapport with your students. While there is no single "recipe" for producing effective letters, there are some general principles and practices which you can employ to give your students their best shot at success.
In the first instance, it is important whenever a student requests a letter from you that you tell the student, honestly, how strong a letter you feel you can write for him or her. While it is true that letters constitute the currency of the academic realm, and your students may seem to be desperate to have your recommendation, they are almost always better off asking someone else if you cannot write a strong letter.
If you feel that you can write a strong recommendation, then by all means accept—and promptly ask the student for as much information as possible about both the competition for which you are writing (application form, due date, etc.) and the student's record (copies of work done in your course, etc.).
When you are ready to write your letter, make sure to use official letterhead if it is available. If you are a graduate student, ask your department if you may use their letterhead for writing letters of recommendation.
Begin your letter by explaining how long, how well, and under what circumstances (course, House affiliation, chance) you have come to know the student. Why are you qualified to comment on him or her? Then move on to the student's qualifications. Remember to give your reader the kind of information about your student's performance about which THEY are likely to care; try to put yourself in their shoes. Include those special features that will interest them. Remember as well to address aspects of the student's performance you know first-hand. Eye-witness accounts are more convincing than hearsay, and specific details or anecdotes will always beat a purely general description.
Finally, conclude your letter with a summary paragraph recapping your main points; if possible, compare the student with others you have known.