President Barack Obama wrote a letter to a lawmaker saying the U.S. could take military action against Iran or reinstate sanctions if the country doesn’t comply with a nuclear agreement, part of an effort by the administration to build enough support to ensure the deal survives.