DO-WHILE loop --- Waiting for pressing of either of 2 buttons

More likely your wiring. From your description of the problem, your pins could be floating.
Read more here https://www.arduino.cc/en/Tutorial/DigitalReadSerial