I am trying to enter the new value in floating point..can you help me fix the code?
There are two ways to fix the code.
One is to collect the data in an array, as each character arrives. When some end-of-packet marker (the carriage return or line feed that the Serial Monitor can send are good examples) arrives, instead of storing it, pass the array to atof() to convert to a float. Be sure to NULL terminate the array after each addition.
The other is to use the lazy way, and call Serial.parseFloat() instead of Serial.read().