If you would like six reasons Nathaniel Hawthorne wrote The Scarlet Letter, they could include the following:
1. In most editions of The Scarlet Letter, you might notice an introduction called "The Custom House." Though most of what Hawthorne writes here is fictitious, Hawthorne really did spend time at the Salem Custom House as an administrator, and there, he did discover some historical pieces that inspired him to create the story of The Scarlet Letter.
2. Hawthorne was quite ashamed of his ancestor, John Hathorne, who was the only judge involved in the Salem Witch Trials never to renounce his participation in the wrongful hangings of Salemites accused of witchery. (For this reason, Nathaniel Hawthorne added the "w" to his name.) The Scarlet Letter, in many ways, serves as a way for Hawthorne to criticize the judgmental nature of Puritans, though for the purposes of his novel, he moved this particular scene of judgment to Boston.
3. Quite simply, Hawthorne had a bit of a creative streak from 1840-1850. He wrote four of his novels during that time, one of which was The Scarlet Letter.
4. While Hawthorne was verbally quite shy, he was able to convey many of his ideas through writing. The Scarlet Letter, among other pieces of his literature, was an opportunity for him to convey many of his ideas that he could not normally convey when speaking.
5. Hawthorne actually did find documentation of a woman sentenced to wear a scarlet "A" to represent "Adultery" -- more inspiration!
6. The Scarlet Letter was probably an opportunity for Hawthorne to address some of the more serious social issues of his time -- religious persecution and judgment, treatment of women, views of sin, hypocrisy, views of God's mercy and forgiveness, for example.