If you do the following it will download correctly:
wget https://github.com/yarnpkg/yarn/releases/download/v0.23.4/yarn-v0.23.4.tar.gz
If you want to use curl you have to use the redirect -L option to follow redirect link and direct the output in a file like this:
curl -L https://github.com/yarnpkg/yarn/releases/download/v0.23.4/yarn-v0.23.4.tar.gz > yarn.tar.gz