Whenever a writer is portrayed in a film or TV series, the process is always the same. They sit at their typewriter or PC (depending on how old the series is), banging out the words, they print out a huge stack of pages, and then they write 'The End' with a flourish, and proudly present finished manuscript to agent/publisher.
I know TV misrepresents a great deal of professionals, but I always want to shout at the screen at this point. I don't know any writer who can churn off a first draft that is perfect and publishable and in need of absolutely no revisions.
Whether you're a plotter or a pantser, there are generally two ways of approaching the writing of a manuscript. Some writers start the first draft with a clear goal of getting to the end. The first draft is likely to be full of inconsistencies and plot holes, but the important thing is to get to the end of the first draft and remember that everything can be fixed in the rewrite. This is my approach. The first draft is effectively putting up the scaffolding. The bricks and mortar and everything else that is required for the construction to be solid and functional can be added in future drafts.
Then there are other writers who revise as they go. Every time they sit down to write, they review what they wrote before and they will quite often go back and polish, or revise and rewrite bits before moving on. So by the time they get to the end they have effectively got a finished product. But it's hardly a first draft, because many changes and amendments have been made along the way.
Whichever way works for you is something that only you will be able to decide, possibly after much trial and error. The point is, revision is essential to the writing process. How many rewrites are required will, again, vary from writer to writer, and may well depend on how much thought goes into the first draft. Some writers I know spend quite a lot of time thinking about each sentence before writing it down, whereas I would rather tap into that early morning flow of words and type the first thing that comes into my head. It means I'm more likely than that more ponderous writer to re-read what I've written and shriek, "what was I thinking? This is complete rubbish and makes no sense". But I know I've got several rewrites to get it right, so that doesn't worry me.
Like many things misrepresented in the media, writing is not as easy as it's portrayed on TV. And no one gets it right the first time.
And so this is the Fifth Commandment. Thou shalt rewrite. And rewrite, and rewrite again, until the manuscript is so polished it shines.