Folks, I am new to Arduino. Need help to automate water tank (water quantity)

Best use a proper float switch, which is designed to be submerged all the time and work well. Two wires may work but not reliable in the long run due to corrosion and debris (may stick to the wires so you don't realise it's empty).

When posting code, please add code tags - the </> button in the full editor.