I have figured out a way of doing it. First of all, a grid of nodes was generated using nested '*do' loop and 'N, NODE, X, Y, Z, THXY, THYZ, THZX' command. Later, elements were generated by using the '*do' loop and 'EN, IEL, I, J, K, L, M, N, O, P' command.
Hi Kumar Ujjwal , this is a good method of controlling element numbering. I would suggest a small modification. Along with the 'N,NODE,X,Y,Z...' command you can add the 'FILL' command within the do loop. This is reduces the time required for generating the nodes, since in case of a geometry with more number of elements (and thus more number of nodes), the use of only the 'N,NODE,...' command makes the node generation process computationally intensive and thus slow. The structure of the code can be something like this:
Let's say we need K rows of nodes with M nodes in each row
*do,j,1,K !counter 'j' refers to the 'j'th row of nodes
N,M*(j-1)+1,X,Y,Z,,,, !generate the first node in the row
N,M*(j-1)+M,X,Y,Z,,,, !generate the last node in the row
FILL !automatically generates nodes in between in one go. The spacing can also be controlled