Why isnt this code firing in shopify additional scripts?

this is in additional scripts section of shopify and im trying to send a pixel event for certain rules. i have pricing rules in place which work fine but this one isnt saving(assuming because it’s wrong

 {% for line in checkout.line_items %}
        {% assign found_collection = false %}
         {% for collection in line.product.collections %}
            {% if collection.title == 'Collection NAME' %}
                 {% assign found_collection = true %}
            {% endif %}
    {% endfor %}
     
     {% if found_collection == true %}

If it isn’t saving because of an assumed error in the code, are you able to post the entire code block?