You might start by looking at the is_user_logged_in()
pluggable function.
https://developer.wordpress.org/reference/functions/is_user_logged_in/
This is basically two lines:
$user = wp_get_current_user();
return $user->exists();
In your case, wrap the links inside the curly braces of a conditional.
if ( is_user_logged_in() ) {
// link
}