Since variable csrFileName changes in every loop iteration, it seems that in console.log call it's value is always equal to the last value it received in the loop. Is it possible to get output which would look like this?