How to delete some elements correctly when deleting an array loop?

If its any help, something like: