Yes, you must have a litter box. Litter training only works if 1. you make it clear to your bunny where he is allowed to do his business and where he isn’t and 2. that you are consistant with it. And most importantly, litter training only works if he has a litter box. If he’s just supposed to go in the cage then in his mind he is free to do his business wherever he wants within those 4 walls. So when you let him roam freely he is simply applying that same principle, only to a larger area. He doesn’t know any different so he doesn’t know he’s not supposed to do it.
Get him a litter box that he has access to all the time. Make sure it’s a bunny safe litter and don’t have anything kind of bedding in the cage. Give him some hay in the box and like I said before, clean up all messes quickly and put them in his box. As he starts to pick up the concept of the litter box and is using it consistantly you can slowly expand his area of freedom.