How to loop over array to change input of request?