Script copy the content of the clipboard into a file
A product like this already exists and is available free on the App Store - Flycut.

From their Github project page:


  Save the clipboard history item currently displayed to a file, closing
  the Bezel. Delete the item from the clipboard history if capital S was
  pressed. Clipping is saved to a file on the Desktop, akin to how
  Screen Shots are saved by OS X. e.g. "Desktop/Clipping 2015-07-15 at
  08.35.10.txt