Hen is used for direct objects.
Hun is used for indirect objects.
When a preposition (e.g. van, aan, etc.) precedes the pronoun -- 'hen' or 'hun' in this case -- then you use hen even if hun should otherwise be used. However hun is generally always correct.
Ik geef hun de appels. - "I give them the apples."
Ik geef de appels aan hen. - "I give the apples to them."
In the first example above them is represented by hun because it is playing the role of an indirect object. The direct object in these sentences is apples (appels). In the second example above, the indirect object is represented by hen because a preposition (aan) precedes it.
- Ik zie hen. - "I see them."
In this example there is no indirect object. The direct object is them, which is represented by hen.
- Ik krijg de appels van hen. - "I get the apples from them."
This sentence is similar to the second sentence above.
In Duo's sentence:
If you use hun instead of hen, then there could be some confusion -- because hun also plays a role as a possessive pronoun meaning their.
Ik hou van hen. - "I love them."
Ik hou van hun katten. - "I love their cats."