I saw that XD plugins can work with content in the document, like adding or editing shapes, lines, text, and so on.
Is it also possible to animate that content in the document?
No (at least not yet). Because plugins execute synchronously, only the final state of the document is visible to the user when the plugin finishes executing.
The newer animation features of XD prototyping are not yet accessible by the APIs.