He and the other trial-takers were not all locked up together. Instead, they were locked up separately. However, he and number seven were locked up together.
Since he was in the terror Battalion, and the trial mission required them to escape, he and number seven worked together. He controlled the beastmen with the sound of his flute, broke the cage, and escaped with the group of people.
Due to the huge commotion, the undead from the terror Battalion pursued them.
They followed the escapees and relied on number Seven's special ability to get close to snakes to cross the snake cave and the underground river.
Song qingxiao and the others led the way, so they passed the Goblin's lair safely and entered the bloody tunnel.
At this time, the other 'number six' had chosen to part ways with song qingxiao and the others after surviving the incident at the undead altar. He was lost in the thick fog, looking for a way to escape from the terror Battalion.