Your main loop has the wrong conditions. Try this instead:
while mercy == 0 and hp > 0 and crabhp > 0:
meaning, that you only do the loop as long as
- no mercy is shown AND
- the player is still alive AND
- the crab is still alive
In other words the game ends if
- mercy is shown OR
- the player is dead OR
- the crab is dead
I hope this helps.
Good luck!