how to repeat code in Function for different things

It does not work.