Why are we returning true/false at every step?

At the end we only want to print our path if it exists. What if i don’t return anything and simply print the path if it exists?

Please clear my doubt anyone.