Hey There,
Firstly I'm puzzled that you're doing this via Keyboard Maestro when Safari has that option built-in.
Safari General Prefs panel:
The issue you're experiencing is most likely a timing issue.
Safari hasn't fully loaded before you're trying to activate the menu item.
You can use a statement like this one to make your macro wait until Safari is really ready to accept input.
-Chris