People write for many reasons: to record something for posterity, or to jog their own memory; to entertain, to inform and educate; to communicate something to others. It had never occurred to me until recently that anyone would write something without intending it to be read. At first, I thought the notion was ridiculous: what would be the point? However, the more I thought about it, the more reasons for doing it I found.
It was after completing a joint project with the writers' group I go to. Originally, we had intended the project to be performed, but as the work went on it mutated into an episodic piece of prose. We toyed with the idea of having it printed as a booklet–one copy for each of us–but the work of formatting it, producing a cover etc. would inevitably have fallen on one or two members of the group, who would have had to put their individual projects to one side to do it. This seemed unfair on whoever took it on when we already had the computer file that we had used to approve and proof the manuscript. 
It would be easy to regard the project as a heap of work for nothing, but from another standpoint it was a successful exercise. The different authors came up with individual work that hangs together thematically and stylistically. We all gained an insight into the approaches of others, which certainly helped to expand my understanding. I believe what we wrote would be thought-provoking and enjoyable for others.
We could publish it in the future, or use it as the basis for something else. The individual authors might repurpose what they've written, but even if what we've produced languishes unread for evermore, I find that it has still been worthwhile for the process of writing alone. Gathering and organising my thoughts, the feeling when the sentences take off, the pleasure of putting pencil to paper, focussing to the exclusion of all outside distractions, and the satisfaction when I've shaped a piece that feels right: they are why I enjoy writing and continue to do so, despite the setbacks on the days when it won't flow.
Writing exercises, scribbling down odd snatches of dialogue or nonsense sentences, filling your favourite fountain pen and writing 'the quick red fox jumped over the lazy brown dog' are all unlikely to be worth showing to anyone else, but they are valid all the same. Writing without deadlines or without any need to please anyone else frees you to write what you want. 
If writing simply for the sake of it gives you pleasure, that's reason enough to do it.