Template with loop returns false not true

I’m trying to get a binary sensor that will check a sensor which DOES have the same value, but it returns false.

I’m embarrassed to say I’ve been at this a couple of hours.

The third line up is to print the result within the loop. The resulting text is

[
  true,
  false,
  false
]

First loop changes the device_found to true, the second loop changes it again to false. Why?

{%- set connected_devices = state_attr('sensor.lee_pixel_bluetooth_connection', 'connected_paired_devices') -%}
{%- set compareme = 'Pixel Buds Pro' -%}
{%- set device_found = false -%}
{%- for device in connected_devices -%}
    {%- set mybtdevice = device.split("(")[1].split(")")[0] -%}
    {%- if mybtdevice == compareme -%}
        {%- set device_found = true -%}
    {%- endif -%}
    {{ device_found }},
{%- endfor -%}
{{ device_found }}

Thanks

Fixed it with this link.