Is there a guidance on how to develop a script/software to export metadata and video onto a MKV or AVI file. Many sincere thank you

No, not really. Let me explain what is there..

For how to retrieve video data (JPEG) see the Media Playback Viewer

https://doc.developer.milestonesys.com/html/index.html?base=samples/mediaplaybackviewer.html&tree=tree_2.html

For how to retrieve metadata see the Metadata Playback Viewer.

https://doc.developer.milestonesys.com/html/index.html?base=samples/metadataplaybackviewer.html&tree=tree_2.html

There is no functionality in MIP SDK on how to create an AVI file (except the export which cannot modify video or overlay video with metadata). You will have to search for sample or information on how to create the AVI/MKV video file, based on single images on which you have drawn an overlay, outside the MIP SDK.