ls is not needed simple `for d in $RPM_BUILD_ROOT/usr/share/autoinstall/modules/*.desktop; do` is enough.
try e.g.` for i in *; do echo $i; done`