ihn = him, yes.
(But not always the other way around, as ihm can also be "him".)
"We need it" was not accepted, but in my opinion ihn could also be a "it" if it's masculine in German.
True, for example:
Du hast den Schraubenzieher. Wir brauchen ihn = "You have the screwdriver. We need it".
However, file this under 'practical real-word tips' and don't expect it to be accepted on Duolingo unless the context clearly indicates you're talking about an inanimate object or animal.
Because, as parents worldwide try to teach their children, wanting something is not the same as needing it.
"Mummy, I need a new pencil case! -- No, darling, you want a new pencil case. You don't need one: your old one is still perfectly good."
brauchen is to need.
Why is it ''him''? Is not it Dative?
That's right -- it is not dative, but rather accusative. brauchen is a regular transitive verb and takes a direct object in the accusative case.
How can I say ''I need her''?
Ich brauche sie.