How to pass username in url

First, you should check if the user is logged in – use is_user_logged_in().
Next step is to get ID of current user with get_current_user_id().
Next, get the URL for the author with the given ID using get_author_posts_url().
The last step is to display the button with the link.

if ( is_user_logged_in() )
{
    $uid = get_current_user_id();
    $link = get_author_posts_url( $uid );
    printf( '<div><a href="https://wordpress.stackexchange.com/questions/344300/%s">My posts</a></div>', $link );
}

You can insert such a code in the header.php file or add it as a function to functions.php file and call this function in the header.php.