file process in the loop working