Make a door in a cube-wall

I have created a wall using a cube. Now I want to create a door in it.

How can I make a door in that cube?

Consider that the cube is automatically generated, so i have to generate the door in a C# script.

If you want to do it all in unity, I would use 3 cubes to make a wall with a door opening in it and then attach an empty gameobject to one side of the door opening to use as a hinge. Then use another cube to create the door itself. However, doing this through code is going to be quite some work, you might want to consider making it in the editor and then making it a prefab, or use a 3D application. You can also create meshes through code in unity but that is kind of advanced stuff.