Welcome @anon96455709 !
Most likely you are surprised that your question has not been fully answered for so long. The fact is that in your question a lot of different terms are mixed - “database”, “odt file”, “Visual Basic macro” - and this shows that your level of acquaintance with this office suite is the most initial. Therefore, in order to give a solution to your problem, the respondent will have to tell in detail about the basics, about the individual components of this office suite (“database”, “Writer text documents”, “macro programming” and much more). When realize how much have to write, it just gets boring. Because all this has long been described in detailed illustrated documents, in many videos on YouTube, in various topics here on this resource. And to answer you with a rude “RTFM” - today it is simply indecent.
I understand your condition. You have a simple task - to take a text document template, insert data from individual rows of a table into some places and get separate files for printing or sending by e-mail. In addition, you have installed LibreOffice, which is written everywhere that it is an excellent free office suite that will do office work for the user. And it’s almost true - the job will be done. But it will not be done by LibreOffice itself, but by you with the help of LibreOffice.
To make things easier for both you and us, I suggest doing the following. You will view topics that can be found on this resource using Search. You will see how and what questions users ask in order to quickly get a comprehensive answer. Then you will break your task into separate steps and you will ask questions for each individual step - each question in a separate new topic. Perhaps this way the decision will be obtained much faster.
By the way, the answer that @jimk posted on StackOverflow to your question was quite detailed - you just lacked the skills to use this office suite a little.