How do I make my variable available inside an assets loop?
Your problem is a scoping issue. You've defined theUrl inside the scope of a for loop, so it only ever lives inside of that loop.

You can do this to have it exist outside of the loop, too.

{% set theUrl = '' %}

{% for item in entry.customerLogoBarUrl.limit(1) %}
    {% set theUrl = item.url %}
{% endfor %}

{% for item in entry.customerLogoBar %}
    {% for asset in item.logo %}
        &lt;a href="{{ theUrl }}"&gt;&lt;img src="{{ asset.url() }}"&gt;&lt;/a&gt;
    {% endfor %}
{% endfor %}