Several points
- What do you mean by "Merge"?.. Word documents have structure and the
interleaving of lines or words would appear to make little sense.

- Unless your application and user base is new, then you will have many
files NOT in the XML format, in which case you would need to convert
them - and would need Word installed somewhere. Perhaps you could
reconsider your platform choice (to make the problem simpler) - or if
you have no pre-existing documents reconsider your approach to make
Word unecessary? Word can read a wide variety of document types
(including HTML) - so perhaps this is another way to simplify your
problem.

More details required...
Graham