Apple script is not doing desired operation for me.

Hey I am new user of MacBook Pro and want to use apple script. I write the script in script editor to delete emails from particular sender. When I click Run this script is running without any error in the Script editor but when I check in the mailbox all mails are still there. Can someone guide me how to use apple scripts.

tell application "Mail" set theMessages to every message of inbox whose sender is "***" repeat with theMessage in theMessages set theAccount to account of mailbox of theMessage set mailbox of theMessage to mailbox "Trash" of theAccount end repeat end tell