how to create a loop and save the data array variable individually