True Kuruharan, it did work for the story.
Sauron's objective was to destroy Gondor's people by any means possible. If they evacuated only civilians, he would hunt them down. In the wilderness, fleeing from Sauron, feeding an entire city of people on the go, with no time to set up farms and a permanent abode would be worse for the people. Starvation would set in even faster outside the city as it would inside. At least they had food stores inside the White City.
Also there was a motive here that affected strategy grately. The whole point of holding out against a seige was to keep Sauron's gaze fixed on Gondor; giving Frodo and Sam enough time to destroy the Ring. If it worked, better to have lost a few civilians of starvation then to have a lot slaughtered by roving bands of Wargs and Orcs. If Frodo and Sam failed would it really matter if they were inside the White City or in Anorien? Either way, they would be screwed.