Constructing single output from multiple EEx files

Forgive me for asking maybe an obvious question, but I am wondering how to use EEx to produce a single output from multiple .eex files. I have looked at the docs but I must be missing something – it does not look familiar to templating I have seen in other languages.

For example, can someone explain please the differences between these 2 statements?

iex> EEx.eval_string("foo <%= bar %>", bar: "bar")
# foo bar
iex> EEx.eval_string("foo <%= @bar %>", assigns: [bar: "bar"])
# foo bar

They are same, no? I am not understanding what difference @ makes – is it just a shortcut for this?

EEx.eval_string("foo <%= assigns[:bar] %>", assigns: [bar: "bar"])

I guess I do not understand why assigns is a special keyword.

But really my question is how to bring together multiple files. This is not for phoenix, this is just a CLI app that must return some text. In PHP I might do something like this (sorry this maybe is not valid PHP):

<?php include("header.php"); ?>

<?php print($contents); ?>

<?php include("footer.php"); ?>

With EEx am I correct that I must build the variables myself? Like this maybe? (but maybe using function_from_file):

header = EEx.eval_string("My header", [])
footer = EEx.eval_string("My footer", [])

template = """
<%= header %>

<%= content %>

<%= footer %>
EEx.eval_string(template, header: header, content: "Something", footer: footer)
|> IO.puts()