There are several ways to write a book. Every author approaches it slightly differently, heck sometimes an author writes every book differently!
Planners write detailed outlines and know exactly what happens when. They have character sheets, and novel bibles, and can even invent their own languages (I’m looking at you, Mr Tolkien.)
Then there are the pantsers, who write, well, by the seat of their pants. They have some notion of plot – I’ve yet to meet one that has no idea where the story is going – but they’re happy to let their characters guide them.
Somewhere in the middle are the planters, which is where I sit. I used to be a pantser, but as I’ve gotten older, I’ve found it more difficult to keep everything in my head. I plan using the “tentpole method” – where you detail a few key plot points (inciting incident, middle turning point, etc) which are like the poles holding a tent up. This method allows a certain amount of freedom as how you reach the tentpole isn’t detailed, while giving just enough structure to stop you from stalling.
All that said, there’s no right way to write a book. You might start out with no plan, then make a rough outline for the edit. Or you go in with a full outline only to find the characters take it sideways. The most important thing is getting the book written. How you get to “the end” isn’t.