The code is functioning exactly as written. The code saves every item in the qty array on every iteration of the IDS loop. I assume there should be a relationship between the IDS and qty objects. Unfortunately, we cannot provide any assistance as we have no idea how the code is supposed to work and we cannot see the table schema.
If the array index relates the two integer arrays then the following should work. But I would rethink the design using a complex type that have the ID and the Quantity rather than two separate int arrays.
for (int i = 0; i < IDS.Count(); i++)
{
var pro = new tbl_purchase();
pro.ProductID = IDS[i];
pro.Qty = qty[i];
_context.tbl_Purchases.Add(pro);
_context.SaveChanges();
}