What you are doing is trying to compare the object name of the collided wall with a string version of the variable name, not with what the wall is actually called.
I mean, I highly doubt the walls in your object hierarchy are called “rightWall” and “leftWall”, right?
In your object hierarchy, call your walls something like “Left Wall” and “Right Wall” if you haven’t already, then change your if/else statement to this: