Motivation is the result of discipline; habits build discipline.
First and foremost, no one is motivated all the time. No one. Not only that, but motivation is fleeting: it’s here one minute and gone the next. You can not rely on motivation long-term.
Discipline comes into play when motivation wanes. You have to get accustomed to “doing the things” no matter how much you may not enjoy them. DO THEM ANYWAY.
“The things”? Those are the habits. Create habits out of the actions that contribute to your goals; this will build up your discipline.
And when the motivation dips (and it will), you fall back on your discipline and habits to carry you through.