Three inputs to control single output(led)

It would be easier if you have fixed temperatures in the sketch.

Potentiometer 1 sets the high temperature, to turn on the fan when it gets too hot.
Potentiometer 2 sets the low temperature, when the fan can be turned off.

What should happen when potentiometer 2 is set higher than potentiometer 1 ? I suggest to keep the fan on for safety and turn the fan off when the temperature is below both potentiometers.

I would like to add a variable that tells if the fan is on or off. It is not needed, but I think the sketch will be better.

if( temperature > high_temperature_setting)
{
  if fan is not on, then turn on the fan
}
else if( temperature < low_temperature_setting && temperature < high_temperature_setting)
{
  if fan is not off, then turn off the fan
}

I made a Wokwi simulation for your sketch: https://wokwi.com/arduino/projects/308488436213350977 It is your sketch, I have only changed the output to the Serial Monitor.