@Simran2 I got that point where you are facing issue, basically point is that you are updating inside loop and you are using outside for all attachment.
@Simran2 I got that point where you are facing issue, basically point is that you are updating inside loop and you are using outside for all attachment.