WordPress custom block: Link saved in database not retrieved when editing post

Your selectors are wrong.

{
    attributes: {
        link1: {
            type: 'string',
            source: 'attribute',
            attribute: 'href',
            selector: '.btn-afil-text-card a:first-child'
        },
        link2: {
            type: 'string',
            source: 'attribute',
            attribute: 'href',
            selector: '.btn-afil-text-card a:last-child'
        }
    },
}

Both of your a elements are the first (and last) children of their parents, which means that your attributes are each getting both values.

:first-child and :last-child don’t get the first and last elements found at all, they get elements that are the first and last children of their parents. What you actually want to get are the a elements that are children of the first or last .btn-afil elements. So your selectors should look like this:

attributes: {
    link1: {
        type: 'string',
        source: 'attribute',
        attribute: 'href',
        selector: '.btn-afil:first-child a'
    },
    link2: {
        type: 'string',
        source: 'attribute',
        attribute: 'href',
        selector: '.btn-afil:last-child a'
    }
},