The double quotes do not protect the backslashes that are inside the sed -e "s|\\|\\\\|g"
from the shell's attempts to parse them. If you use a simpler example you can see this a bit more easily:
$ echo 'blah\blah'| sed -e "s|\\|blah|g"
sed: -e expression #1, char 10: unterminated `s' command
$ echo 'blah\blah'| sed -e 's|\\|blah|g'
blahblahblah
If you want to use the first form of your sed
you need to switch it to single quotes instead of double.
$ figlet -t "Foo Bar" | sed -e 's|\\|\\\\|g'
_____ ____
| ___|__ ___ | __ ) __ _ _ __
| |_ / _ \\ / _ \\ | _ \\ / _` | '__|
| _| (_) | (_) | | |_) | (_| | |
|_| \\___/ \\___/ |____/ \\__,_|_|
If you have to use double quotes, then you need more backslashes to escape the shell and sed
:
$ figlet -t "Foo Bar" | sed -e "s|\\\|\\\\\\\|g"
_____ ____
| ___|__ ___ | __ ) __ _ _ __
| |_ / _ \\ / _ \\ | _ \\ / _` | '__|
| _| (_) | (_) | | |_) | (_| | |
|_| \\___/ \\___/ |____/ \\__,_|_|