If you've used macros in Emacs, sooner or later you'd need to automatically increment as expressed in this thread. If you read the thread, you'd see a number of suggestions but the simplest is to use the builtin Emacs counters. The Emacs manual too mentions how to use them.
The Emacswiki too mentions how to use them and some tricks in getting it to do it the way you want.
Learn it, it saves a tremendous amount of drudgery typing