Without knowing what operating system(s) those thousand machines are running and what the naming conventions on each of those thousand machines is for user's home directories, there isn't much chance that we can help you with a request like this. Knowing what shell you'll be using on the machine where you are running this script and on each of the thousand machines you'll be querying could also make a bg difference.
And, of course, this assumes that the directory named .ssh in each user's home directory is owned by that user (and not by root). One might also want to know if any user names on those thousand machines contains the string id .