How can I get the newest file from a directory?

Parsing the output of 'ls' is a bad practice, you should create a loop and compare the timestamps:

saved_ts=0
for f in *; do
  f_ts=$(stat --format=%Y "$f")

  if ((f_ts > newest_ts)); then
    newest_ts=$f_ts
    newest_f=$f
  fi
done

there you'll have the newest file at $newest_f, notice that when a file changes also changes its timestamp so this will get the last created or modified file in the directory.