For why the double quotes, and why the -- in the second method, see Why does my shell script choke on whitespace or other special characters?Why does my shell script choke on whitespace or other special characters?
Another problem with your script is that command=`ls -l` sets the variable command to the output of the command ls -l, which is not a list of file names. If you recall Why does my shell script choke on whitespace or other special characters?Why does my shell script choke on whitespace or other special characters?, you'll remember that it's impossible to store a list of file names in a string variable: all the file names are jumbled together. Here, it's even worse: there's junk like permissions, dates, etc. The way to get a list of file names in a shell script is to use a wildcard pattern.
The echo command might mangle some file names. To be safe, use printf. For more on this, and on the use of double quotes, see Why does my shell script choke on whitespace or other special characters?Why does my shell script choke on whitespace or other special characters?