Auto-translated
I don't know how to remove units that have been present since the beginning of the battle (you need their scripted name).
local units = GetCreatures(DEFENDER);
for i, unit in units do
local unit_id = GetCreatureType(unit);
if(unit_id == DEVIL_ID) then
removeUnit(unit)
end
end