Add records in System by reading data from Excel



Data i am trying to enter has parent child relations . For a given header record there could be one or more child records. I could successfully mimic action of creating one child line for one header record , but when there are more than one child records , as soon as i hit new record button to create 2nd child record , control comes back to the first record created and it starts overwriting the first records . Do you have any suggest as in how to find empty record created on new button click to fill in the details .

Any help ,suggestion is welcome