Cannot get simple programme working

Using the String class can cause memory problems. See the Evils of Arduino Strings page.

Your method of user input is blocking. If you want to be able to do other things while waiting for the user to respond, chapter 7 of Robin2's Planning and Implementing an Arduino Program tutorial shows how.