We should be able to launch the script from command line to do the following things
1) Start In-Design;
2) Open a template file with filename (input 1);
3) Invoke the merge feature with another filename (input 2);
4) Detect any warnings or errors including overset, once detected, a corresponding text file will be created (output 1);
5) Save as result file (output 2) into a provided file name (input 3);
6) Close In-Design;
Step 1 and 6 should be Applescript, while Step 2 - 5 could be InDesign Script.