For multiple ids how to Extract table data in web page dynamically

@sangeethaneelavannan1 im getting these ids from variable. i want to loop the same fuctionality for multiple ids, For one id it is working fine but other ids im getting 1st id data.
image