It takes decades.
Start by reading. Read all the literature you can. Enjoy and understand the stories; but pay attention to the authors' CRAFT-- how they use the language, how they describe things, how they set up the plot and provide suspense, and so on. There is nothing wrong with sort of copying another author's style, at least when you are getting started. Many people have begun this way. I wrote 'Love Me Do' as a modern (1970s) take on 'The Great Gatsby'. My style is/was very different from Fitzgerald's; but even when I teach 'Gatsby' in the classroom today I am sort of amazed at myself for having understood (and sort of copied) his book so well... when I was 17. And 'Love Me Do' is not at all a bad book.
The second thing, as you begin to read a lot, is to try to discern good writing from bad. Avoid Nicholas Sparks and Stephanie Meyer. They tell great stories but their craft is not worth emulating. They write after their audience-- 8th-year girls. Move on from that. Read Vonnegut, Rand, Delterfield, Trollope. Explore stuff you never thought you would like. Again, study craft.
Sting, the bass player for The Police, once said, 'Whenever I run out of song ideas I go back to my craft.' He sits and plays the bass for hours on end, for days on end. And we thought this guy was good; and still he practises. Why? --because there is truth in the adage that one learns well by doing. So, DO. Write everything and anything that comes into your mind. Read, think of something, write that down. Critique films, TV, the books you read-- decide what is bad and good about each. Criticise your own writing from days/months/years ago. Improve it. This is not playing for an audience; it is practice. But it's the only way you can grow. To avoid attempts, even when they (will) end in failure, is to choose to not improve. You can't pitch a ball till you try to do it. So, try. Fail. Learn. Try again. Fail again. Learn more. And repeat.
As you write, go back to the books you liked, read alternate passages, and compare them. Is your grammar/mechanics/spelling/usage equivalent to that guy's? If not, why not? Evaluate and improve. This is called editing. It's been said that there are no great writers; there are only diligent editors. ALL writers are editors before they are 'famous published authors'. Get out of your head the idea that the first endeavour is the purest, the sweetest, the most valuable because it's so pure and sweet and original. That's Romantic; and whatever they write, NO good writers are purely Romantic. They believe in hard WORK-- and that lies in editing, revising, critiquing, really looking judiciously at what they have written. There is nothing accidental or innocent or pure about it. All art, including literature, must be deliberate. It's what makes it 'art' (artifice, that which Man creates).
During the editing process, I take my work in a 3-ring binder to the beach. (It's where I live.) I sit there reading like it's someone else's work, like it's from a student or someone, with a blue pen in hand, and truly beat up the whole text. 'Stop repeating,' I write. 'Delete this,' I write. 'What idiot wrote this?' I write. I put myself into the mindset of the reader. Then I fix it so *he* will like it (even when it's just me). It's all about the reader. If you don't serve the reader, why are you writing? You write to be read-- that is the definition of an author. So think of how it reads when you read it. If it rots, fix it. That's your job.
I'm sorry for preaching at you but there is really no easy way to do this without just DOING it. There is no app for your iPhone that you can buy and install and *become* a good writer. You have to just start doing it, like riding a skateboard. And you will fall on your bottom and become injured-- in this case, in your EGO-- and you deserve to get slapped about a bit by it and then you will learn. And you will go at it again, and again. And then you will have succeeded, because YOU will have succeeded. And no-one can ever take that from you.
There are plenty of easier things to do. You could sell flowers in a shop. You could flip burgers at McDonald's. You could deliver newspapers (does anyone still do that?). But you want to write. So what are you reading this drivel for? Start writing.
I am an editor, educator, critic & author. Also, I read stuff :)