functions prints all the data from array