Think about what happens if you add a rule somewhere between the existing ones. How would your script learn the new number of the rule it works with?
The line numbers are intended solely as a help for the human administrator when modifying the configuration, so that the find would not be necessary for every step done manually.