The narrator, a Bostonian, returns after a brief visit a few summers prior, to the small coastal town of Dunnet, Maine, in order to finish writing her book. Upon arriving she settles in with Almira Todd, a widow in her sixties and the local apothecary and herbalist. The narrator occasionally assists Mrs. Todd with her frequent callers, but this distracts her from her writing and she seeks a room of her own.
Renting an empty schoolhouse with a broad view of Dunnet Landing, the narrator can apparently concentrate on her writing, although Jewett does not use the schoolhouse to show the narrator at work but rather in meditation and receiving company. The schoolhouse is one of many locations in the novel which Jewett elevates to mythic significance and for the narrator the location is a center of writerly consciousness from which she makes journeys out and to which others make journeys in, aware of the force of the narrator's presence, out of curiosity, and out of respect for Almira Todd.
After a funeral, Captain Littlepage, an 80-year-old retired sailor, comes to the schoolhouse to visit the narrator because he knows Mrs. Todd. He tells a story about his time on the sea and she is noticeably bored so he begins to leave. She sees that she has offended him with her display of boredom, so she covers her tracks by asking him to tell her more of his story. The Captain's story cannot compare to the stories that Mrs. Todd, Mrs. Todd's brother and mother, and residents of Dunnet tell of their lives in Dunnet. The narrator's friendship with Mrs. Todd strengthens over the course of the summer, and the narrator's appreciation of the Maine coastal town increases each day.

Question: Why did she return to Maine?
Answer: To finish writing her book.
Alternative answer: to write