The point to writing is to write something you would read. Once you do this, you’ll be able to focus more on how you want a story to form, and less than the doubtful ideas of “no one is going to like my story.” Because, honestly, if you’re writing something you would read, then you’re already writing for a target audience. There will definitely be hundreds of thousands of people who are interested in the same thing as you, so…
But as far as motivation goes, I think of it as a way to add excitement to the story. If I lose motivation, then I’m losing my excitement for it. The question is… how can I get that excitement back? Well, the best way to do it is to plan the story and add things (that you think is exciting) into the story. Or, if you already have a plan, you can add more onto the story or change the plan that fits better with your needs.
I’ve had multiple times where I changed something, particularly in the moment, that wasn’t added to my original plan. For example, I had a scene where my character was trying to look for clues on the murderer—which were put into the original plan—but at the last moment, I decided to run a different course. In my original plan, he had found something, then hid because the murderer came back, and when they left, he snuck out and went back to his house to meet up with his friends. Well, I changed this part of the story. Instead of him sneaking out, the murderer came in and knew my character was hiding, so they dragged him out from the bed (yeah, bad hiding place haha), knocked him out, and later strapped him to an electric chair for torturing purposes. This is my definition for “keeping things exciting.”
So when I had added this, I wanted to continue writing. And once I got through with it, I kept on finding new and interesting scenes (that were relevant to the plot, of course) that were thrilling.