I’m also looking into how to build walls. (Used your code here)
With your code createProfiledContourUV or createProfiledContourMMgeometry it’s possible.
But i have a hard time to understand what the values for the shape are or should be to just create a square wall like in your example.