When is it not exercise of discretion but rather overstepping, legislating?

question mark

A President has the job of executing laws written, passed and signed by the President.  The President doesn’t write laws. 

The President DOES have discretion on how the laws are executed but that discretion is not unlimited. (Think about this: Federal prosecutors, as part of the Executive branch, have the discretion what indictments to seek from a grand jury….or what plea deals to offer etc.  Prosecutors can’t make up new crimes that Congress never wrote and charge someone.)

Where is that line between a proper exercise of discretion and an improper exercise / legislating?