There are two reasons to write: 1) for yourself; or 2) for others.
If you write for yourself, it could be as simple as needing to get words down. Of course, there might sneak in the hope of fame (recognition) or wealth (money), too. If you write for others, it could be for the pleasure of entertaining, or for recording history, or making connections. Why you write may be a weaving of all the above.
Why do you write?