I often talk about how to write, but the main thing, I think, is to create a routine. You can’t just write when you feel like it, because there’ll be other things that feel better at any particular time, and you’ll never get round to it. So if you want to write, create a routine.
There are other things too: flight-time is massively important – the more you write the better you get at it; the proverbial ten thousand hours does no harm. And finish what you start. Everything you complete, even if it is bad, is a step higher up the ladder towards producing something worth reading.
It helps if you’re an avid reader; I don’t think you can write if you’re not also a full-time reader and can count your reading time in many multiples of ten of thousands of hours. It’s part of your flight-time.
So, write lots, read more, and have a routine.