A locked cage is actually safer than being loose
In this particular instant, even though these men are extremely dangerous, they pose no threat to anybody since they're in a locked cage. Literally the only reason they got out was that they cage was burned and Arya freed them.
Presumably, under normal circumstances, they'd stay in the cage until they reached the Wall, at which point there are plenty of officers ready to keep them in check.
The George doesn't see this as a problem; neither should you
It's fair to point this out as an issue, based on your presumptions and thoughts, however, the author George. R. R. Martin doesn't. And for this simple reason alone, we must assume that this simply works in Westeros.
Here's is a transcript of a discussion he's had with a fan about this issue:
NIGHT’S WATCH RECRUITS AND MAGIC
[Interviewer]: Even the behavior of dungeon recruits on their way to the Wall seems atypical of criminals. This behavior could be read as evidence that those chosen from the dungeons are acting under a mild geas, even though that fact has been forgotten in present-day Westeros. Given the variety of options open to escapees, both in Westeros and across the Narrow Sea, it is difficult to accept that, e.g., Yoren's last band would set out without stringent security measures in place. But if generations of recruits have gone more or less docilely to the Wall, it is easy to see how the peculiarities of their behavior might not be noticed, except by someone like Tyrion.
[GRRM]: *There is no geas intended or implied, not even a mild one. I suspect that you and I just disagree on what constitutes the "typical" behavior of criminals. I don't find any peculiar anomalies in the behavior of Yoren's band of recruits, though I gather you do.
I don't have the time or energy to argue the point, alas -- except insofar as the book itself constitutes my side of the argument. Like any writer, I have to write my characters as I see them, based on my own observations and knowledge of history and human behavior... but I recognize that disagreement is possible, and probably inevitable. Hell, writers often disagree with one another.
As to Yoren's band... he did keep the three most dangerous men in chains, and many of the unchained were orphan boys, volunteers, or petty criminals like thieves and poachers, none of them likely to give him any trouble. But his success, such as it was, does not necessarily mean that =all= past recruits went "docilely" to the Wall. I have no doubt that over its long history the Night's Watch had its share of murders, mutinies, and runaways. But they were relatively rare events... as rare as shipboard mutinies, prison riots, and slave revolts have been in the real world.
-SSM Entry - September 10, 2000 (NIGHT’S WATCH RECRUITS AND MAGIC)