You would also need oxygen to run any sort of engine on hydrogen. So, just extracting hydrogen from lunar soil doesn't get you anything useful (unless you have a not-yet-invented fusion reactor that will run on light hydrogen).
The idea of extracting water is that you get the product of combustion, and use solar energy to separate it into the hydrogen and oxygen that you can then combust as rocket fuel.
So, you are really running the rocket on solar energy - it is stored in the propellant and oxidizer.
Of course, collecting rocket exhaust to use the water for some other purpose is not likely to be feasible, considering how hot it is and how fast it is moving, not to mention that the rocket is going somewhere else during the process.
The rational way to use hydrogen and oxygen to generate power would be with a fuel cell. Again, water would be separated by using solar power, and then the energy is stored until needed and used in the fuel cell as needed.