This is what we call a "Schachtelsatz"
A sentence gets an addition by a sentence fragment , or many, the number is infinite. You have to take it apart and work it piece by piece.
Sie hielten sich ohnehin nie lange auf in dem Heim,
They never stayed long in the orphanage anyhow,
Here it all starts. A fine perfect sentence , but insteadt of a dot it ends with a comma and starts a multi-clause sentence.
einem Haus am Rande der Stadt,
Now the orphange "Heim" is described in more detail, in a fragment of a sentence that can not stand by itself ( there is no verb ) but as part of this multi sentence its just fine.
a building (located) at the outskirts of the city
in das Kinder gebracht wurden,
the function of the house is added to the explanation
in which children are brought
die herumstreunten,
the children get a closer look
which prowled around
so it goes on and on and on, each new sentence fragment explains a subject from the sentence that came before, that description is followed by yet an other. As sad before this can be infinite.
es war ein Durchgangsheim.
finally there is a summary, at the end of the listing.