Why is the 'else' email text duplicating in my confirmation email customization?

I am working on sending 2 different emails based on whether an order is custom or not. I got most of the code to work, but the {% else %} email text is duplicated and I can’t figure out why. Here’s the code I’m using & I’m attaching am image of the preview email with duplicated text.

{% capture email_title %}Thank you for your purchase! {% endcapture %}
{% capture email_body %}
  {% for line in line_items %}
{% if line.title contains "Custom" %}
Hi {{ customer.first_name }}, Thanks so much for your custom order. [ To submit your photos and additional information please fill out this form. ](https://forms.monday.com/forms/031acb40d5010ecae82166176ef0c801?r=use1) When your order is ready to be shipped you will receive another email with tracking information. 
{% else %}
  Hi {{ customer.first_name }}, Thanks so much for your order. You will get another notification when your order is ready to be shipped.
{% endif %}
{% endfor %}
      {% if delivery_instructions != blank  %}
        

**Delivery information:** {{ delivery_instructions }}

     
{% endif %}
{% endcapture %}

I think it’s because you’re doing this inside a for loop, which will output for as many items that are in the cart, probably 2 in the preview.