That motivation must be intrinsic for it to last. Extrinsic motivation, such as the thrill of getting published and/or benefitting financially happens too rarely, and doesn't occur often enough to keep feeding a writer's motivation sufficiently. The motivation must be internal.
A lot of people say, and some have said to me personally, that they want to write a book. Very few of those people complete the task. A book is a massive undertaking and can take an enormous amount of time and energy. Often people lack the time, or the energy, or both. They lack personal motivation. Writing must be a passion, the fulfillment of one's dream.
I remember trying to complete my first draft while I was still teaching in public schools. I would come home exhausted some days, with no energy left to write at all. But I would make time when I did have energy to continue working on my debut novel. Eventually, I finished it. It was such a big deal to me that I bought a bottle of French champagne to mark the occasion. My wife and I enjoyed celebrating that milestone, but I knew that it was in fact just the beginning, similar to attaining a black belt in karate. The Japanese word for black belt is 'sho-dan', which means, 'first step'.