I could not find wiring diagrams for this situation. A leaking water heater was replaced by a newer one that is "almost" the same. I believe the thermostat goes in series someware.
See attached drawing.
See attached drawing.