Interfacing Arduino for variable power supply
You can use a relay in order to control the heater. The heater should turn on when the temperature is lower(&lt;=40 degrees) and turn of when its 45 degrees, which is the hysteresis, like mentioned in the comment from Spehro Pefhany. Without knowing the rating of your heater and setup, I can't tell you what kind of a relay you need. The biggest problem is measuring the temperature, since water needs time for the temperature to become even everywhere and your sensor will be at 1 place. You can check this setup, its the same as what you need: https://create.arduino.cc/projecthub/whitebank/arduino-heating-element-control-224882