Assuming you're trying to figure out if the $line subdir is non-empty, try this:
if [ -n "$(ls -A $homedir/$line$homedir/$line)" ]; then
"if * then" ends up attempting to execute the files in that subdir. If one does not have the execute bit set, you'll get the Access Denied. Even if it worked, it would not find .files, which it looks like you're interested in given the presence of .ssh in the egrep pattern.
if [ -n "$(ls -A $homedir/$line$homedir/$line)" ]; then
"if * then" ends up attempting to execute the files in that subdir. If one does not have the execute bit set, you'll get the Access Denied. Even if it worked, it would not find .files, which it looks like you're interested in given the presence of .ssh in the egrep pattern.