Hey Thomas ,
As per our discussion , We have sap package in our content folder.
There I can go to this path
/sap/hana/xs/ide/editor/server/repo/packageLib.xsjslib
And can tweak the code as there I have function for createNewPackageInternal and other functions and can achieve the creation of package through XSJS code.
Please comment on this.