As 3dgs_snake already mentioned a simple way would be to use ent_next. You have to make a little adjustment though when you want to remove the entities:
you = ent_next(NULL);
while(you)
{
ENTITY* you2 = you;
you = ent_next(you);
if(you2._type == type_ball) ptr_remove(you2);
}
A more sophisticated approach would be to create an array (or better: a list) yourself in which you save all ent_created balls.