During that time children were sold to sweep the chimney.
Here, the two works-- 1. selling, 2. sweeping are being done by two different people / group of people.
The pencil is used to write something.
Here in the second example, both of the works-- 1. using, 2. writing are being done by the same person.
I'm confused about the first sentence and I heard the it from someone. Is the sentence valid?
Thanks in advance.