Is there a purpose to writing? Of course there is a purpose for writing. Is there a purpose for living? There is a purpose for living! The purpose of living is to experience authentic and sustainable happiness. That is, the purpose of living is to experience positive and desirable emotions. There is a reason for posing this two potentially unrelated questions; the purposes of writing and the purposes for living intersect.
Writing is a tool. Writing is a tool that can be used to experience more happiness. Writing can be persuasive. Writing can affect emotions in readers. Writing can be used to create a call to action. Writing can be about philosophy, emotions, psychology, ethics and so forth. Writing can have direct and indirect impacts on far off events, events that are far off in time and space.
There are many ways to accomplish what writing is meant to help accomplish. For example, suppose there is a worthwhile scientific research project, like to defeat malaria. Journalists, writings and biologists can all work to help defeat malaria. Perhaps someone is even a biologist who is also a decent writer; and they can write not only research papers, but also books or articles for mass readings by readers who are not experts in biology.
There is of course a purpose of writing. Earning money from writing is possible. Earning money of course should not be the primary reason that one writes. Hopefully more individuals will attempt to spread worthwhile ideas through writing that have the potential to benefit humanity on a massive scale. Hopefully more books will be published that may serve to create more authentic and sustainable peace on Earth.
With regards to self publishing books and articles, there are many available options available to aspiring writers. There has perhaps never been more opportunities than there currently are. Internet technology has changed the ways in which writers are able to publish their ideas.
Hopefully more individuals will discover their own unique purposes and reasons for writing. Hopefully humans will write with purposes that are honest, worthwhile, peaceful and so on. Using writing for purposes that are nefarious, malicious or greedy is morally deficient and wrong.
Writing to benefit yourself and others is the best reasons and purpose to write. There is a purpose to writing and it should indeed be to benefit your own self and others in what ever one of the potential infinite number of forms that that can take.