All I can say is: I've been trained for academic writing for like 8 years now, and I still struggle to do it without a good template. Formatting in a text editor is it's very own skillset IMO.
Most important is to make a skeleton, a loose progression of stuff like
1.X
2.Y
2.1 Z
And look at ONLY that for a while and think 'what do I want to reach each chapter? Why is this chapter here and not earlier/after? What needs to be said before this can make sense, and is the flow of it logical?
what will be the next question on my readers mind, and does this Adress it?'
Also think about who you are writing for. What do you need to explain, and what can you expect as given etc