If you ask a writer 'why do you write?', you tend to get some version of this: because I have to, it's a part of me, I would die if I couldn't write. That's fine and noble and all, but not necessarily insightful. Having a little clearer idea of why you write, what you want to get out of it, I believe will make you a happier writer. So maybe you want to take a closer look at yourself and be honest about why you write. Don't worry about justifying it to anyone else, don't worry about making it sound romantic. Just think about what you get out of writing, and perhaps how to get more of it.
I think when you examine it there are several different goals we each have as a writer, some of them perhaps contradictory. And most of them valid and worth honoring. I's very important to realize that some are more important (to us) than others and some are harder to control than others. And just because one person has a specific goal that is different than yours does not make them any better or worse as a writer. But understanding what your true goals are will allow you to do your best to try to achieve them. And it also helps you filter the many pieces of contradictory advice you may receive from folks who may have different goals than your own.
So let's start with those who just write for themselves. If that's true, that you just enjoy writing, then you can write whatever you want. But are you writing because you enjoy creating characters? Or do you get excited about crafting intricate plots? Or is world building your thing. What exactly is it about writing that you enjoy? If you like completing a story then short stories will be more gratifying than epics - you'll complete a lot more of them. But if it's the challenge of working out complicated threads that come together to form a beautiful tapestry, then epic novels might be the way to go. So really think about what aspect of writing it is that gives you pleasure (or it may be more than one) and write for that. You don't have to worry about what anyone else thinks or suggests. Be happy doing what makes you happy.
But what if you want other people to see your work? I think many writers write because they want to share their ideas. We want others to see what we see and (hopefully) experience some of the joy and wonder we get when we look at the world we create. Part of this is validation - we want others to appreciate what we do. Perhaps some would look at this as a weakness, but if so it's a common one. Most of us want to be told that we've done a good job and that our efforts have in some way given others enjoyment. I don't think that's a bad desire at all. But another part of this is simply the challenge and satisfaction of creating something inside someone else. It's an incredibly powerful thing to be able to create something outside of yourself, and sharing your writing can do this. When an idea that was once yours now belongs to the readers, something that they can even share among themselves and others, you have done something special in this world. If this is your goal, then you need to take the audience into account when you write.
Now 'audience' could mean different things. It could mean your writing group, it could mean your friends and family, or it could mean the thronging masses.Whoever it is, you need to write for them as much as yourself. Writing for yourself you can use bad handwriting, obscure abbreviations and awkward grammar - you'll still understand it. But if you want to convey your ideas to others, you need to present them in a format that is easy for the reader to understand. The grammar has to be clear and enjoyable, you have to explain more while still entertaining. You have to be cognizant of who they are, what they expect, and ultimately what you want to create in them. This will, and should, influence what and how you write. There is nothing wrong with that- you are still writing for your goal: to share your ideas with others. Their enjoyment and appreciation will be your reward.
If you want your audience to be the general public, then you need to take into account how you're going to get your writing into their hands (and heads). So you also need to think about what it takes to get published. If you want to sell your book to a big publishing house then you will increase your chances by knowing what they are looking for. What genres are hot? What are the standards in that genre? What's the word count they prefer? These are things that make it easier to sell a first book and that will get it out to the people.
If you want to self publish then you don't need to impress an agent or publisher. But you still need to attract the readers. You need to make sure your cover is appealing, that your description is clear and inviting, that the start of the story will grab the reader and have them dying to finish the whole thing. So once again, you need to consider your audience and write with them in mind, not just throw words down on paper that make you happy.
And what if you want to write in order to make money? People need to make a living somehow. Most writers (or aspiring writers) don't seem to have a problem with getting paid for their work. But there does seem to be a suggestion that if you start looking at the financial aspect of things instead of simply writing 'the best book you can write' that you are putting the cart before the horse. But if your goal is to make money off your writing then you should do whatever is going to maximize your chances for success. And that may include writing what's popular, writing what's most sell-able, and sometimes even jumping on the bandwagon. Realizing that up front will ultimately make it easier and save you some grief. As long as you put your best effort into it and enjoy the uphill battle, then go for it.Writing may be a calling to some, a noble art that is pure and above crass considerations of the marketplace. But I myself have nothing but respect for those who are actively trying to make a living doing something that they enjoy.
The truth is we all have multiple goals and get different things out of different types of writing. I write some things that I will never share - they are just for me to enjoy (I like these 'cause I don't bother editing). Some things I write with a very focused eye towards being able to sell them. Some things are ideas I like and expect others might as well, but probably a small subset of the larger population. Sometimes I write simply to improve my writing so that I can enjoy the other writings more - it's the equivalent of running laps so I don't get so winded when I go skiing. I enjoy it all, but I always try to be aware of why I am writing right now, and try to get the most out of that that I can.I write with a goal in mind, even if I lose myself in the middle of the process. Because sometimes getting lost is the goal.
So why do you write? (and whatever your answer, good on ya for doing it)