Created a method for the key input for restaring and exiting the console application