How to make automator run an applescript that turns of mac?
You can use the following in an AppleScript to shutdown the system:

tell application "System Events" to shut down


If you really want to click the menu items you can go straight to clicking the "Shut Down" button with the following:

tell application "System Events" to click menu item "Shut Down" of menu 1 ¬
    of menu bar item "Apple" of menu bar 1 of process "Finder"


Note: I've add the ¬ Line-Continuation Symbol to keep from having to horizontally scroll to see the entire line, just remove it and place it all on one line in the script if you want.  If you want to actually bring up the Shut Down message change "Shut Down" to "Shut Down…".