Bash scripting doesn't have the best support for xml parsing...
Depending on who the data is written to the file it could be either very difficult or very easy.
Say the data looks like this:
Code:
<book>
<path>/home/you/books/author/title.ext</path>
<title>Test Title</title>
<author>Test Author</title>
</book>
<book>
<path>/home/you/books/author/title2.ext</path>
<title>Test Title</title>
<author>Test Author</title>
</book>
All you would need to do is iterate over each book node, get the path, title, and author values, then create the command line arguments for ebook-meta and call it. If you use python you could actually the components directly from your script. If you go this route you can find everything you need in calibre.ebooks.metadata.cli.