The for loop is redundant, the script is already looping, so you can just call interact(filter) and it will progress through the inventory.
As everyone else suggested, you should add a sleep after the interact to wait for the potion to actually be consumed before trying to drink the next one.