I can't extrude on the z axis I was trying to extrude the edges in the z axis using the extrude tool from the toolbar and not the shortcut key. The first time I extruded the edges it was fine. But the second time I tried to extrude the edges I couldn't do it in the z axis. It was allowing me only in the x axis. I was wondering what have I done wrong.
Wow. This is a curious one. I think this is what's going on..

You're extruding edges, along their median (actually mean) Normal, which is to say the mean normal of their vertices. In the first extrusion, all the vertex normals have a -Z component, the X's and Y's cancel, so the mean normal is -Z. In the second extrusion, none of the vertex normals have a Z component, the other components cancel, and so the Normal is 0. Blender seems to gives an arbitrary vector for this?
TL;DR
Fill the hole and  extrude a face, which has a normal, of use the XYZ setting for the tool.