created output variable to store all the results in an array and then output that at the end of the response