The simplest way I can recommend is to record a macro and take the python code from there. You can create individual elements in the mesh module if you are defining an orphan mesh. Just record the process of creating the element and assigning properties then you can easily reuse it to do whatever you want.