Error Message with the "Delete Duplicate Records" Code

Error Message with the "Delete Duplicate Records" Code

This is what I was told to put in to find duplicate entries in a a data base and delete.  But when I do I get an error message. 

myList = list(); 
duplicateRecordIDList = list(); 
for each record in myForm [ID != 0] 
if ( myList.contains (record.Email) ) 
duplicateRecordIDList.add(record.ID); 
else 
myList.add(record.Email); 
delete from myForm [ID in duplicateRecordIDList ];

This is the error message 
Error at line number : 1
Improper Statement
Error might be due to missing ';' at end of the line or incomplete expression