I am working with AppleScript and need to do this:
set TextToWrite to \" #!/bin/bash cd \"$( dirname \"$0\" )\" java -server -Xmx4G -jar ./craftbukkit.jar\"
To insert literal quotes into an Applescript string, you have to escape them, i.e.
set myString to "This is a \"quoted\" text."
AppleScript has the same convention as most languages, which is to use a backslash for escaping of special characters, of which there are only two: quotes and … backslash. See the section “Special string characters” of the AppleScript Language Guide.