Several thousand Central American migrants languished in filthy, overcrowded conditions within sight of the U.S., facing sickness and indefinite waits amid shifting U.S. border policies that barred them from crossing.