OK, I missed the way the vacuum was formed.

It doesn't clearly work until you add up all the energies.

When the explosion occurs it pushes the piston, then immediately the gas condenses and forms a vacuum which tries to pull the piston back the wrong way! There's a loss of energy, taken from the flywheel.

That's assuming the burnt HHO goes straight to liquid water. It'll first turn to water vapour, and that vapour won't condense until there's enough pressure. Keep it sealed off and it'll probably never condense even after it's cooled to room temperature.

The energy losses from the compression,exhaust and intake strokes in a normal engine are pretty low. The massive dumping ground of most of the fuel's energy goes into high temperature exhaust and heating up the components of the engine when it burns. Your engine is no better in those regards - it still needs massive external cooling to dump all that heat from the burnt gas.