If logged in user views his profile page

You can make use of the get_current_user_id(), get_the_author_meta('ID'), and get_edit_user_link() functions. Take the below snippet for instance:

if( get_current_user_id() === get_the_author_meta('ID') ){
    printf( '<a href="https://wordpress.stackexchange.com/questions/314019/%s">Edit Profile</a>', get_edit_user_link() );
}

get_current_user_id() will return int(0) if nobody is logged in, or the integer ID of the current user. This effectively removes the need for is_user_logged_in().

get_the_author_meta('ID') will return string(0) "" if there’s no
page author (for instance on the home page), or the integer ID of the
author if there is one, such as on the WordPress Author Archive page.

You could also add is_user_logged_in(), but as I mentioned above, I think it’s a bit redundant since get_current_user_id() essentially takes care of that for you:

if( is_user_logged_in() && ( get_current_user_id() === get_the_author_meta('ID') ) ){
    printf( '<a href="https://wordpress.stackexchange.com/questions/314019/%s">Edit Profile</a>', get_edit_user_link() );
}