There are several websites that features a variety of letters that you might use when writing to a judge, depending on your purpose. Google "sample letters to the judge." Use the quotation marks.
The internet would be a great place to find example letters to a judge. Another place to find information on how to wright an appropriate letter to a judge would be the library.
Most law libraries have copies of such documents, or even on the courts direct website. These days you can even find copies on the interneta and various websites. Sometimes you can even contact a public defender and ask for help.