`{% set attributes = attributes ~ ' ' ~ attr ~ '="' ~ value ~ '" %}`
Missing double-quote, no?