In the `if` conditions you should use the `defaults read` command, and not `write`. Otherwise the result is always true and of course the `elif` never runs.
Also, that is not the syntax for `if` conditions. You should use:
if [ $(command) == "TRUE" ]; then
But in this case, perhaps something like this would be less verbose:
STATUS=$(defaults read com.apple.finder AppleShowAllFiles)
case "$STATUS" in
"TRUE") OPTION="FALSE" ;;
"FALSE") OPTION="TRUE" ;;
esac
defaults write com.apple.finder AppleShowAllFiles $OPTION
killall Finder