Loop the data already received on the serial monitor

the main idea of the program is to repeat over and over the information received in the serial monitor,
for example:

if the serial monitor receives the data:

12
13
13
14
14

what i would like to do is, get that data and make it loop inside the serial monitor like:

12
13
13
14
14

12
13
13
14
14

12
13
13
14
14

etc