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, iteratively updating the average payoff each time you are done with generating a path allows to *free most of the memory* 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 with 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 based on your own constraints (for instance matlab uses a quite limited java heap size by deault).