I did not find any helpful information here.
It is happening because of this code:
n is constant throughout the loop (
n=1 in this case), new element will be added to the
index=1 for each iteration
Yes! N referers to the same place every time.