Began constructing loop function

experimenting to see if i can get it to return what i want