Extracting variables from for loop-1