Now, this is mostly with fiction writing, specifically in terms of novels, poems, plays, etc. in mind, but it can also be applied to non-fiction in the same context, or even in terms of reviews, blog posts, etc. Whatever you like to write, at least one of these steps could prove handy for you.
1) Read, read, read.
Reading is a really great way to learn. I taught myself various things simply by reading books and paying attention to what authors did. Of course, just because someone is published doesn't mean to say their writing is the best, or even accurate. They can still be wrong. But reading is a great place to start.
It can help you with the writing side, but it can also help with staying motivated, getting more acquainted with a particular genre or audience, and much more.
2) Surround yourself with creative outlets.
TV shows, movies, video games—whatever it is, surround yourself. Like books, they can help with a variety of things such as storytelling, worldbuilding, developing characters, and much more. The difference is, these will provide a visual. If you want to write for a TV show, for example, it doesn't hurt to watch them.
Music is a great option. It can keep you motivated while you write, spark an idea in you, and much more. Podcasts are similar. They could be informative and teach you a thing or two about writing or the subject matter you're exploring in your writing. Both options could get you out of writer's block or help you to switch off when you've been caught up in your writing for too long.
3) Do your research.
This can be done in so many ways: searching the internet, reading books, talking to people, etc. It's so easy to know when someone hasn't done their research so even the most basic research will give you the upper hand and make the quality of your writing so much better.
Just don't get too run down by it all. If you stress too much over whether every little detail is accurate, it can keep you from actually writing. It's all about finding the perfect balance. Do research when needed, like when it's a big part of the story, when it's something you're not that informed about, etc.
4) Write, write, write.
A lot of people will tell you that the best thing when you want to do something is to actually do it. So, if you want to write, write. Even if you're not sure what you're doing or you don't think you're very good, write anyway.
Continuously writing is an incredibly good way to develop and/or hone your skill. The more you write, the more practice you'll have. So long as you're willing to learn along the way, in order to minimise your mistakes, over time, you could really improve your skill.
5) Don't be afraid of drafts or re-writing.
It's a common thought that the first draft is always the worst. You could very well be one of those people who can never write a good first draft, and that's okay. It'll allow for you to get everything down on paper and then re-writing will allow you to refine all of that.
Naturally the more you plan and the better your first draft is, the less you'll have to refine later, but it never hurts to have more than one draft. Having it all written down could provide a really great outline for you to work from, which might help to improve the quality of your work by flushing out all of those immediate thoughts you might have.