See https://orgmode.org/manual/Extracting-Source-Code.html
First set :tangle
header args. This is the location which the file will be
written.
:PROPERTIES: :HEADER-ARGS: :tangle lit-test.el :END:
Now, just by calling org-babel-tangle
a file called lit-test.el
is created
with the following code blocks written to it separated by a couple newlines.
(print "foo2")
(print "bar2")