title: How to use a here document in a loop?
body: <p>This works:</p>
  
  <pre><code>name="test.txt"
  
  yap -q &lt;&lt; % &gt; $name
    [experiment_yap],
    exp1_min(brother,2).
  %
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>for i in 01 02 03 04 05
  do
    name="test.txt"
  
    yap -q &lt;&lt; % &gt; $name
      [experiment_yap],
      exp1_min(brother,2).
    %
  done
  </code></pre>
  
  <p>I receive line 19: syntax error: unexpected end of file</p>