with-temp-file

with-temp-file is a Lisp macro in `subr.el'.

(with-temp-file FILE &rest BODY)

Create a new buffer, evaluate BODY there, and write the buffer to FILE.
The value returned is the value of the last form in BODY.
See also `with-temp-buffer'.