Autogenerate bpmndi tag

Hi Team,
I am creating an application which will generate BPMN files automatically. But while generating, I miss bpmndi tag there. Could you please help me to auto-generate bpmndi tag in my BPMN & let me know the procedure?

Need the help in JavaScript

<bpmndi:BPMNDiagram

I’m not a javascript expert. However, I wrote a modeler for block-structured BPMNs once. Using BPMN-js, you can create BPMNDI elements as follows (example of task):

         const bounds = {width: 100, height: 80, x: 0, y: 0};
         const attributes = {
            id: 'some_id',
            bpmnElement: theElementForWhichYouCreateTheShape,
            bounds: moddle.create('dc:Bounds', bounds)
          });
        const planeElement = moddle.create('bpmndi:BPMNShape', attributes);
        bpmnDiagramPlane.get('planeElement').push(planeElement);