Use a variable as index in Tkinter
With only this information is hard to say what the purpose of this, but directly answering your question you can use string interpolation python.org such as .format method:
for i in range(1, n): a = text.get("{0}.0".format(i), "{0}.end".format(i) ) b = text.get("{0}.0".format(i + 1), "{0}.end".format(i + 1))