Ah, I thought you want to save a file such a text file.
You have to say "do shell script" and then something like that: defaults write com.apple.Finder AppleShowAllFiles NO
Instead of NO you can use your variable and instead of com.apple.Finder you use the name of your .plist file.
The .plist file has to be in the following directory: ~/Library/Preferences/.
I hope this helps!