Keep in mind that your 'if' statements must be terminated. For every 'if', there must be a 'fi'.
While I'm not totally positive what you are trying to do (looks like a lot of code just to find executables), it might make the most sense to use 'find -perm +4' or '+7'. Depending on the permissions you are looking for, find can search and return a list of files with specific permissions. Check out 'man find' for more info. For a more lightweight method, you could use 'ls -l | grep rwx' (or 'r-x').