If you're like me, it can take years to get published, decades even. During that time, it's important to write what you love, or in my case, what I wanted to read but couldn't find. If you write a Young Adult vampire novel because they're blazing hot sellers right now, but you don't really like YA vampire novels, it will show in your pages. Not to mention, by the time your book hits the shelves, YA vampire novels probably won't be so hot anymore (or maybe they'll be so hot that it's nuclear). The point is, the market changes quickly, like blink of an eye quick. So to stay sane and happy, write for your passion, not for market popularity.
That love for what you're writing, the fun, the passion, the "I can't wait to get back and visit with my characters" will all have to be strong enough to keep you going day after day, week after week, month after month -- you get the picture. And when your book is in your local Barnes & Noble, your readers will sense the passion that you had while writing it.
Your passion has to be strong enough that you want to write every day -- that you have to write every day. The difference between a writer and someone who likes to talk about being a writer is that you're compelled to write, they're compelled to talk. Your day isn't complete unless you write. It's like an obsession. Writing isn't something you do; a writer is what you are. And published or unpublished, nothing will change that.
If my books hadn't been published, I'd still be writing Raine Benares stories for myself -- or that Urban Fantasy that's clawing for my attention. I wouldn't have stopped trying to get published, but not getting that contract wouldn't have stopped me from writing.