You need the field key that you’re using on the dynamic profile page, then add this line of code as the button link.
Since you’re using the atname key to build the profile page URL, you need to use it to build the URL, I’ve coded the link for you but I couldn’t find the button ID that you want to take the user to his profile, just change the button ID (in blue) and you’re good to go.
$w('#button1').link = '/userprofiledata/${atname}';
if you’re on a dynamic page that belongs to its owner, you need to get the gtname value first in order to use it in your link.
let profile = await $w('#dataset1').getCurrentItem();
let atname = profile.atname;
$w('#button1').link = '/userprofiledata/${atname}';
Put the above code inside the page onReady() function, and define it as an async function.
Hope that helped.
Ahmad