if you want an engine to run you need the chemical reaction to be more exothermic than the previous ones and the net energy to be positive
when you try to break up water during electrolysis you give energy with 30% losses to heat to make the more unstable version of "water" which is hydrogen
when you burn it inside the engine you take back the energy you gave during electrolysis with 70% losses to heat
what does it take to figure out this can't work?
when you make alcohol you can start from a higher energy density chemical to a lower energy density chemical thus the net gain in energy will be positive, in theory you can convert sugar to alcohol and run the car with it, alcohol water efficiency may reach up to 70% because water acts as an expansive agent, you can't do this with gasoline or diesel. The problem is that you can't make alcohol fast enough with the current technology for the engine to burn. If enough money is spent I'm pretty sure cars could run on sugars, this is the fuel of nature.