Rat in a maze backtracking

Please help me out in this question

Hey @Sfo_2302
There are 2 changes in ur code , mentioned them in comments