For writing there can be three basic purposes; to record, to communicate and to express.
Agreements, books of account, bank statements, research papers, case studies, subject books etc are written for recording. Recording the collected data, in form of information for observation, evaluation and outcome. Recording for keeping a proof for future; for further analysis, research, development; for facilitating education on a given subject.
Letters, daily newspapers, weekly magazines etc are examples of writing to communicate. Communicating to share information and exchange updates so as to maintain a certain level of general awareness and understanding on current and common affairs.
Songs, dialogues etc are written to express our state of mind. Blogs and Social networking softwares are used for social communication as well as personal expression and record. To express emotions like love, happiness, fury, compassion, disgust, horror, bravery, admiration, all of which we contain, essentially in our mind I think.
Now, I mention Literature. A written artistic work, with a high and lasting artistic value. Art is a function of human creativity, imagination, beauty, truth, depiction of life, attempt to decipher life and fix the puzzle. It needs to be given complete devotion. It can not be a passionless. Art drips in form of words on to the papers, through the nib of a writer's pen. If it is not artistic, it is not a literature, it a just a book. Because art is soulful, it inspires and fulfills heart.
Literature is never written for mere purpose of recording, communicating, expressing and earning. It is creation, the way pot is created from a clay, the way fabric is weaved from a fiber. Any act of creation, I assume is pleasant but time-consuming, exhausting but satisfying and painful. (Like birth of a baby !) Perhaps writing a literature is like giving birth, giving it a blood and life, and being a real tangible god of it. To be a master, a writer first labours to acquire skill of writing, knowledge of language and deep sense of words.
I do not know what happens most of the times, if one writes literature or some genuine written piece of a genius turns out to be a literature? It is true both ways. Highest purpose of writing is creation of art, creation of a life itself.