How can I automatically create edges according to the number of vertices?
You have a couple options:
Triangulate:
Press F with everything selected to make an n-gon, then press CtrlT to triangulate it:

Bridge:
As Leon Cheung already mentioned, you can use the bridge tool.
Select the opposite edge loops (in this case, everything) and press W&gt; Bridge edge loops or WE.

This method will create quads if the the edge loops have the same vertex count but otherwise creates triangles. You can press AltJ to automatically convert some of the tris to quads.
Fill:
You might already know this, but I thought I'd mention it just in case.
Fill now automatically detects vertices for the new faces, so to do what you did in your question you only have to select two vertices and then repeatedly press F.