Written language systems that allow the reader to approximately recreate the utterance of the writer date back to at least 3200 BC, making writing more than 5000 years old. The writing of numbers is much older. The use of pictographs is older still. Suffice to say writing has a long history.
Writing is a learned skill. In the days of pictographs the writer tried to communicate something they saw; a herd of gazelle, a bear, a sunrise. As the skill improved, standardized images took on specific meanings; names, places, items, concepts. With the development of ideograms and hieroglyphs the recording of stories became possible. Writing became something more than a skill, it became a craft.
With the development of written systems that represented spoken language it became possible to capture in written form the lyric and flourish of the orator. Writing was certainly used for mundane daily use; the recording of sheep sold, the process of grinding grain. Still, it had taken on a greater purpose. It recorded law and speeches; ideas that could only be imagined.
Doubtless in the earliest days writers wrote what others spoke. Writing was a recorder; a means of fixing and retaining the thoughts of the speaker. It was a way to insure that future generations could learn what their forebears knew and thought. Once writing became a system that could direct speech, writers took to writing stories that had never been spoken. The craft of telling stories required something a little more. It required the ability to write with the eloquence of the orator, without the orator. The skill coupled with the craft and writing became an art.
Regardless, though all of these manifestations the sole purpose of the skill or craft or art is to captivate and hold the reader. To relay to them anything from the number of sheep sold, to the beauty and warmth of the sunrise. Through all its incarnations its goal has been to cast incantations. It is all about the reader.