save dataset in for loop