Remember that (barring any changes you've made) a KM "Execute Shell Script" action initialises a shell with the current working directory set to / (see @ComplexPoint's earlier post). So you shouldn't be able to write out a file unless you first cd to somewhere writable or specify a path to such.
Try the pwd command in both a fresh Terminal window and a KM "Execute a Shell Script" action to see the difference.