I daresay that there are some writers for whom the words just flow in perfect order - like Mozart taking dictation - but for most writing is a process. Some will plan and then write, others will write and then plan. It doesn't matter what your process is, and it may take some time and plenty of trial and error before you work out what your personal process is.
There will almost certainly be several phases:
A thinking phase.
A writing phase.
A planning phase.
A re-writing phase.
A fine tuning phase.
But the order in which you tackle each phase is personal to you. So, some people go chapter by chapter, thinking, planning, writing, re-writing, fine tuning. Others will write a whole mad first draft in a great burst of energy, and then start the thinking and planning processes. The order you do things in doesn't matter, so long as you do them.
My mother told me not to fret about when my babies walked, or talked or was potty trained, on the grounds that they'd all manage it by 18. It's the end product that matters, not how you get there.