yes, you are right dear but here the problem is in last log msg if use index o it shows the last element and if i use any number bigger than 0 then it says Index was out of range that means outside the 1st foreach loop the value in list is only one. and in second for each loop it does the same showing last element.
and if i use this log message inside the 1st for each loop then it shows all the expected result.