@Warget Usually real shell scripts start with a shebang (or magic line):
#!/usr/bin/env bash
cd ~/Downloads
echo "password" | sudo -S installer -allowUntrusted -verboseR -pkg "~/Downloads/Imprimantes.pkg" -target /
Give this a try. On the other hand it also could be a problem with the sudo command. When running this script in the terminal by hand you do this in your user context. The fog client executing this same script does it from a different context (account) which might not be allowed to run sudo.
Anyhow… Having the password in the script is definitely not a good idea. Please read about ‘sudoers’, ‘NOPASSWD’ and such things on the net. This way you should be able to make this work and still have it a little more secure than saving the password in your script file.