How to use EEPROM to save my settings value while the program is running.

    Serial.println(Serial.available());

Why are you doing that?

          realh=Serial.read();

You read ONE character. Must be a pretty short tank - less than 10 cm tall.

You don't seem to have a clue that the Arduino is not waiting (and should not wait) for serial data to arrive.

          Serial.print("Enter Your Minimum value (in cm)");
          while(Serial.available()>0)
          { 
            if(Serial.available()>0)
            { 
              maxi=Serial.read();

Why are you storing the minimum value in maxi?

              Serial.print("Enter Your Maximum value (in cm)");
              while(Serial.available()>0)
              {
                if(Serial.available()>0)
                {
                  mini=Serial.read();

Why are you storing the maximum value in mini?