If you want to execute loop in series like a synchronous code, you should use async.series or async.waterfall
series(tasks, [callback])
Run an array of functions in series, each one running once the
previous function has completed. If any functions in the series pass
an error to its callback, no more functions are run and the callback
for the series is immediately called with the value of the error. Once
the tasks have completed, the results are passed to the final callback
as an array.
waterfall(tasks, [callback])
Runs an array of functions in series, each passing their results to
the next in the array. However, if any of the functions pass an error
to the callback, the next function is not executed and the main
callback is immediately called with the error.
Waterfall chains callbacks to pass output of one as input of next, series just executes in series.