This would run only the cat on the remote host and then run the two grep commands locally.
I've also added the -F flag to the grep commands, assuming that the strings used as patterns are not regular expressions but literal strings that you'd like to search for. The last grep uses -q as we're not actually interested in seeing the output, just in whether it contains the string success or not.
To make it easier to read, I've put the arguments used with ssh into an array that I later use in the call, and I've also made the lines a bit shorter by simply inserting newlines after the pipe symbols. The script is still syntactically correct. Also note that any expansion of variable etc. should always be double quoted, unless you know in what contexts this is not needed.
Note that I'm assuming that the ssh command is invoked in the correct way.