(let ((buf (get-buffer-create "*foo*")))
(with-current-buffer buf
(insert "bar"))
(goto-char (point-min))
(insert "foo")
(buffer-string)))
;; => "foobar"