"Gli scrive un libro."
Gli is plural (them), right? But when it used like this, it can also be translated as singular (him)? Or only as singular?
Gli can be different parts of speech. Gli elefanti sono grandi/the elephants are big = determinative article. Gli vendo un elefante/I sell him an elephant = pronoun. Gli + noun = the. Gli + verb = him/to him.
There are times when gli also works for plural... that has to do mostly with indirect objects. However, nowadays gli is starting to replace other pronouns (such as le and loro) in spoken Italian... but don't worry about that here, we try not to overlap :)