In Spider-Man: No Way Home, Doctor Strange asked Peter to collect all these other villains from other universes and put them in these cells/locked spaces before he can send them back to their universes, all what is left of the spell is a press of a button. Peter asked his friends to press the button if they don't hear from him.
The question is, if they could have sent them all back on the press of the button without the need of collecting them, why didn't Doctor Strange just do it there and then? Why going through the hassle of getting them into those cells?