The word "He" refers to Josiah. He would have commanded his workers to do these things. Hilkiah and the priests who assisted him did these things. Alternate translation: "He had them clear" (See: [[rc://en/ta/man/jit/figs-metonymy]])
# the houses of the cultic prostitutes in the temple of Yahweh
Possible meanings are 1) the houses were in the temple or 2) the prostitutes were in the temple.
# in the temple of Yahweh
You may need to make explicit that the houses were in the courtyard around the building, not in the building itself. Alternate translation: "by the temple of Yahweh" (See: [[rc://en/ta/man/jit/figs-explicit]])