The permissions most likely started out as 0755 because of your umask is set to 0022 (a common default - man umask for exactly what the umask means)
As for the ownership, unless you're running the script as root, you probably don't have the permissions to change the ownership of a file - always check your return codes for errors!