The Write to a File and Append Text to a File actions allow you to write a variety of things to a file on disk.
Write or append the current system clipboard, a named clipboard, a variable, some text or some styled text (you can write but cannot append styled text).
Select the file to write to by specifying its path. Click the File Chooser button on the right to select an existing file on disk. Option-click on the File Chooser button to show the currently selected file in the Finder (assuming it exists already).
You can write the file in a variety of formats, including plain text, RTF or RTFD, SimpleText, as an HTML folder or web archive, or a Word Doc, Word XML, Open Office XML, or Open Document. You can only append to plain text formats though.
Clipboards which contain images can be written in various formats: PNG, TIFF, JPEG, BMP, GIF. Plain text formats can have a specified character encoding: MacRoman, ISO-8859 Latin 1, UTF-8, UTF-16.
If you change the format or extension of the file in the ‘to file’ field, the ‘with format’ selector changes to match. If you hold the Option key down and change the format selector, the extension in the ‘to file’ field will be left unchanged (7.0+).
Note the difference between the Write and Append actions: Write changes the entire contents of the file on disk while Append adds the new content at the end of the file.
For text, the action allows you to control what text processing happens in the gear menu (7.2+) :
Most other Text Fields in Keyboard Maestro process both text tokens and (except for regular expression fields) backslash characters.