Erlang Inverse of file:consult/1
This snippet is taken from https://zxq9.com/archives/1021
write_terms(Filename, List) ->
Format = fun(Term) -> io_lib:format("~tp.~n", [Term]) end,
Text = unicode:characters_to_binary(lists:map(Format, List)),
file:write_file(Filename, Text).