Good question.
Nanowrimo says to just get in there and write and don’t stop until you reach the end. There’s a good reason to follow that advice, namely that if you keep revising as you write, you might not ever get to the end. This is a real problem for many writers and is why many books don’t get finished.
On the other hand, if you are the kind of person who knows where they are going and keeps plugging on, then revising as you write may be a good idea because, when you reach the end of your manuscript, you are truly done.
No rewriting required because you did it as you wrote.
I rewrite as I write and I prefer it that way but honesty compels me to admit that I didn’t do so until I had many years of writing beneath my belt because the changes I kept making during that learning period changed everything and required entire rewrites of my manuscripts until nothing ever was finished. I had to eventually force myself to write the entire manuscript first so at least it would get finished.
Now, however, I’ve learned how to keep on task so rewriting as I write works for me.
Do whatever works for you.