How to fix the index value that I use for X_test and y_test?
I've changed the range values in the loop and indexing for training and test data. (Also, it seems you are using the dataset instead of data by mistake.)

i:(999 + i) contains thought rows locations of which will be incremented by one as the loop progresses.

for i in range(0, 999):

    X_train, y_train = data.iloc[i:(999 + i)], target.iloc[i:(999 + i)]
    X_test, y_test = data.iloc[i + 1000], target.iloc [i + 1000]