(require '[clojure.java.io :as io])
;; the first method: spit writes the whole string at once and closes the file
(spit "file.txt" "Line 1\nLine 2\n")
;; the second method: a writer, when the text comes in pieces
(with-open [w (io/writer "file2.txt")]
(doseq [line ["Line 1" "Line 2"]]
(.write w (str line "\n"))))
(print (slurp "file.txt"))
(print (slurp "file2.txt"))
(flush)