okay, so what I recommend when you have the time is to read the man page for 'sh' or 'bash' which will explain how 'for' works, as well as backticks, redirects, substitution, etc.
You are doing this:
find $directory -type f -perm 666 -print | wc -l > results.txt
which is outputting the result of 'wc' to 'results.txt' Thus results.txt contains...