Shell Script Commands Work Fine in Terminal But Not Via AppleScript
Your script above is running two different scripts. One is changing the working directory to your user desktop folder (~/Desktop). The other script is downloading www.google.com and putting it in a document in your root directory (/), which doesn't have permissions to do so.

You can fix this by reduce it to one statement of do shell script like such:

do shell script "curl www.google.com &gt; ~/Desktop/google.txt"


In short, the script first downloads the contents of the website www.google.com and then creates a new file at the specified directory. You may also notice the ~ character, which is equivalent to /Users/username/.