Parsing output of ls to iterate through list of files is bad. So how should I go about iterating through list of files in order by which they were first created
You can try using use stat command piped with sort:
stat -c '%Y %n' * | sort -t ' ' -nk1 | cut -d ' ' -f2-
Update: To deal with filename with newlines we can use %N format in stat andInstead of cut we can use awk like this:
LANG=C stat -c '%Y^A%N' *| sort -t '^A' -nk1| awk -F '^A' '{print substr($2,2,length($2)-2)}'
LANG=C is needed to make sure stat uses single quotes only in quoting file names.^A is conrtrol-A character typed using ControlVA keys together.