Although I don't remember this part of the book explicitly, I guess Glasserman implements Monte Carlo this way to preclude memory-related issues.
Indeed, when you incrementally computeiteratively updating the average payoff each time you simulateare done with generating a new path as he suggests, you can store the running average andallows to free most of the memory afterwards after each Monte Carlo simulation: you only need to store the running average.
On the other hand, the second approach you mention requires simulating and storing all the paths before you get to compute the average payoff.
In other words, Glasserman's implementation will work even if we runwith thousands of millions of Monte Carlo simulations, while on most work stations the second method would fail (not enough memory).
Note that in certain programming languages, the second approach can benefit from vectorisation (I'm thinking matlab and the likes). Hence you should choose your implementation wisely dependingbased on your own constraints (for instance matlab uses a quite limited java heap size by deault).