None of the brackets and quotes are necessary and are not valid parts of a defaults write command.
Here's a valid defaults write command that works in a bash script:
defaults write com.apple.Safari Homepage "http://google.com/"
here's a loop of defaults write commands I use to modify user templates on OS X:
for USER_TEMPLATE in "/System/Library/User Template"/*
do
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.SetupAssistant DidSeeCloudSetup -bool TRUE
defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.desktopservices DSDontWriteNetworkStores true
defaults write "${USER_TEMPLATE}"/Library/Preferences/.GlobalPreferences.plist AppleKeyboardUIMode -int 3
done
So, your example correctly formatted would look like this:
defaults write /Users/test/Desktop/myplist MyKey MyValue
of course you'll need to add the appropriate switches if you want the key to be written as something other than a string- see the examples above for boolean and integer keys being written.
Finally, check the man page for the defaults command- it does a great job of going through all of this.