This is not how it works. For water, standard enthalpy of formation is lowest among all known compounds of hydrogen and oxygen. Consequently, hydrogen that was obtained via electrolysis ALWAYS will be a HUGE lossmaker. Energy spent on its generation must come somewhence, and it better be cheap to overcome the significant cost of hydrogen leg in this grand scheme of energetics.