Do you write for yourself or for others? Does it matter? As a kid, before I could play an instrument, I would make up songs. There was "That House Is Haunted" which sounded a lot like "These Boots Are Made For Walkin'", and "The Chinese Song" which sounded a lot like "Baja" (by The Astronauts). These were not good songs, but I could imagine the instrumentation and the sound based on the pop music that we heard on the radio. I don't remember feeling a need to share these songs with anyone. I can say with confidence that I was writing for my own enjoyment.
As a teenager, I learned guitar and started playing music with other teens. We had strong opinions about the artists we liked and we were impressed by what appeared to be their carefree, hedonistic lifestyle. I began writing music for two reasons; one, because my pop idols did it so I should do it, and two, if you want things done your way, you gotta do it yourself.
The more you do anything, the better you get at it, and almost anything you make yourself is better; a loaf of bread, a garden wall, a poem, or a painting, you made it, it's yours, it’s better. I enjoy most styles of music, but in my life, when the world wasn't providing any cool tunes, I could always make my own. In the 80s, I made home recordings and shared with other home recorders. Many of us (myself included) hoped that someday we'd write a hit song and be launched into an exciting new world. Well, the years have passed and I'm still obscure, but I have a catalog now, and every now and then I hear from people who tell me they like my work. That's pretty nice, especially when it's one of my favorites.
Going back to the start then, do you write for yourself or for others? Does it matter? I think it does not. You can cook a Thanksgiving dinner or just make yourself a sandwich. Either way, you're making something.
We are social creatures, and music is a form of communication, so I think everything we write is, on some level, meant for others to hear. At the same time, consider your own inner dialogue. Sometimes the communication is within ourselves, but sometimes a message meant for ourselves has meaning for others too. The notes and chords and lyrics make us feel a certain way. That feeling might represent a question or an emotion or an affirmation. To inspire, or motivate, or soothe another person is a great accomplishment. You've created a tool for living. You've made the world a better place.