How to programmatically add objects into cryptomatte node?
I think the best way to do this is to open up a text editor window in blender by putting your mouse on the corner of the 3d view and dragging to open it.  This will open up another window and you can change the window type to text editor.  Click new and you will have opened up a file.  Next open up a python info window using the same procedure.  You can now see what all your commands are in python.  You can add objects like this by typing this into the text editor:

for i in range(10):
    *stuff*


replace stuff with the commands that you see printed in the info tab that you used to create your shape.  For example, once you make a cube you see a command in the info tab called bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, location=(0, 0, 0)).  You could then copy that command into your code to create your shapes.  If you want to learn about python scripting I would recommend reading blender's python documentation.