measured = allotted, or divided by lot. See note on "line", below: i.e. David divided into two companies those who were to be spared and those who were not.
them = the territory. Put by Figure of speech Metonymy (of Subject), App-6, for their territory. line. Line, put by Figure of speech Metonymy (of Cause), App-6, for dividing or allotting what was measured with it. Deu_3:4, Deu_3:13 (region); 2Sa_32:8, 2Sa_32:9. Jos_17:6, Jos_17:14. Psa_19:4. Amo_7:17. Mic_2:5. 2Co_10:16.
casting them = casting down the cities. See note on "them", above, and compare 1Ch_18:2 = " made them his servants", or vassals.
to put to death. These were soldiers in arms, not inhabitants.