Save history to python and load from python console
While the info window is helpful it does not show a complete list of actions taken, the steps it does show can be expanded.

While copy and pasting an operator is an easy way to duplicate some steps in a python script, it is usually preferred to directly alter the data in a python script rather than just calling operators. You can find the reference to blender's python api online which also has some introduction tutorials to get you started.

For an example of creating a mesh object you could have a look at the add object addon template that is included with blender.