makes forloop to run over all the data