I presume you want to pump water into an overhead tank from an underground one, right? Or is it that you want to simply boost the pressure from your existing water line or tap?
You will need some sort of sensor to sense the level of water in the overhead tank (call it S1) and another to either check water level in the underground tank or the water pressure in the tap/line (call this S20)
Start pump if, S1 reads low and S2 reads high, else stop the pump.
The program could be something like (using BASIC pseudo-code notation),
Sensors S1 & S2 are physically connected to ports P1 & P2 for the below...
[code lang="vb" line="none"]
DECLARE PIN1 AS P1 ANALOG_INPUT -- Setup uC pin 1 as analogue input port P1
DECLARE PIN2 AS P2 ANALOG_INPUT -- Setup uC pin 2 as analogue input port P2
DECLARE PIN3 AS P3 DIGITAL_OUTPUT -- Setup uC pin 3 as digital output port P1
WHILE (TRUE)
BEGIN
READ PORT P1 -- Read Sensor S1
READ PORT P2 -- Read Sensor S2
IF P1 < [Some preset level] AND P2 > [Some preset level]
BEGIN
WRITE S3 port HIGH --Turn on pump relay connected to port P3
END
ELSE
BEGIN
WRITE S3 port LOW --Turn off pump relay connected to port P3
END
END
[/code]