Hi Hariom,
Besides what Holger said please be aware that those imbricated loops, along with the usage of the appendToDocumentList service might cause performance problems if you have a large number of records.
I would recommend redesigning your approach (if it is something productive and not a POC) and doing some load tests to be on the safe side.
Best regards,
Vlad Turian
#webMethods#Flow-and-Java-services#Integration-Server-and-ESB