So before going to bed I’d write what I have to do tomorrow, don’t write too many things but it’s okay if you do
Afterwards, arrange the tasks by how important they are to you; for example, A for most important followed by B and so on, or you could use numbers.
The next day make it your job to start with the most important thing and work your way down the list so you accomplish what it is you want to accomplish.
For example, I’d have to study for an exam and that should be my top priority but also I’d have to do laundry or clean my room, I used to not prioritize and I’d do laundry and clean my room and whatever else tasks that aren’t as important as studying. I’d feel like I accomplished something but it’s not the right thing to do.
Tl;dr: start your day with the more important tasks
To stick with the habit, treat yourself after you succeed in staying focused on the task for a given amount of time.
Try the pomodoro method if you have a short attention span. (25min work, 5 min break, repeat until you did what you wanted to achieve)
Do not have your phone with you when working, or anything that will break your focus. (Computer, game, people, etc.)
Lastly, keep believing in yourself. The more you achieve a short session per day, the better you build your habit. Even if it's just 15 min a day the first day, by being consistent, you will be able to double, then triple (if you want) that amount. Because diligence helps your mind focus and not look for distractions.
I hope you took the time to read all of this and that it helped you a lot. I have had a lot of attention troubles ever since being a child, so I understand exactly how it feels to not be able to work consistently. Once I managed to discipline myself, I started making wonders in my workfield… Good luck to you!