while the electrolysis of water under the right conditions is a mild endothermic reaction ( some of the energy chemically stored in the hydrogen came from the heat in the environment ) … in order to get a net output equal or better than what you put in is extremely difficult.
The smallest amount of energy needed to electrolyze one mole of water is 65.3 Wh.
When the hydrogen burns with oxygen it releases 79.3 Wh.
This is a 14 Wh improvement … these 14 Wh are not free … it is energy that was exothermically absorbed from the environment during the electrolysis.
Water is not the fuel… this is just a means of extracting some of the thermal energy from the environment.
the problem is that no combination of equipment is efficient enough for this to be a sustaining reaction… The most efficient electrolyzer I know of is specialized extremely expensive equipment and still doesn’t even get 90% of the energy that goes into the electrolyzer ending up in the conversion. The home made stuff is rarely even 50% efficient.
the other question is how efficient can you be when you convert it back to water? how much of the released energy can you utilize… again it is not 100%… spark ignition engines are usually less than 30% efficient … even the best combustion engines don’t get anywhere near efficient enough.
How about the generator mechanical energy back to electrical? we will have a hard time getting better than ~95% efficiency.
So how efficient would you have to be?
At best you have about a ~21.4% endothermic gain.
So if you start will 100 Wh…
using a magical 90% efficient electrolysis… you get 90Wh
90Wh + our 21.4% endothermic gain puts us up at 109.26 Wh
a normal ~30% efficient combustion engine would only give us ~32.8 Wh
So we need a magical combustion engine too:
90% efficient combustion engine will give out ~98.3 Wh
now we need to convert that mechanical energy to electrical energy.
with a high efficiency 95% efficient generator we end up with ~93.4 Wh.
So you start with 100Wh of electrical energy and end up with 93.4 … even with magical components that are far far more efficient than you will ever get in the real world.
I have no doubt you could run a engine like this… but it is a battery powered combustion engine… as the battery is supplying all the energy, and you are not generating enough electrical energy to recharge the battery as fast as you are draining it.
Now the other / separate thing is by adding small amount of hydrogen to gasoline combustion you can make it more efficient… because of the higher flame speed of Hydrogen… but Hydrogen also has less energy per unit volume than gasoline does… so while your efficiency would go up… your power would go down.
this is also still a gasoline powered engine … the water is just being used as a fuel additive.
Just my 2 bits.