Familiarize yourself with the position. Get a copy of the job description, if you can, and talk to the person you will recommend. If you know the intended recipient of the letter, ask them about the position as well. The more you know about the position, the better you will be able to tailor your letter to suit the needs of both parties.
The best way to write a letter of recommendation is to start out with a formal greeting, or using "To whom it may concern" if you don’t know the recipient. Follow the greeting with 2-3 sentences of praise for the person you’re recommending.