Changing wallet password using double quotation marks turn out to be mysterious (Qtum Core)
This is really a Bash question, but I'll bite.

Bash (or any UNIX shell) will treat " symbols as begin and end of a literal. Inside "", spaces and special characters inside that would otherwise have a special meaning are permitted.

One of the permitted special characters inside is the newline. That's exactly what's happening here. Your "test"" plus " on the next line is seen as "test" plus a newline between quotation marks. As a result, your new password is test plus a newline character.

If you would want test" as your password, one way would be to use single quotes instead of double quotes. One of the characters permitted inside single quotes is... the double quote character.

So you could use

walletpassphrasechange 'test' 'test"'