Modify “Must be logged in to comment” text/links?

The text, “You must be logged in to post a comment.” comes from this line in WordPress:
https://github.com/WordPress/WordPress/blob/efaf4a8938bbeb8510c8e1e4cc6fe84a434c17c3/wp-includes/comment-template.php#L2449

Whenever you see something wrapped in the double underscore function __( ), it means it’s a translatable string.

You can use a function like this and add it to your themes functions.php file:

add_filter('gettext', 'change_comment_logged_in_notice', 20, 3);
/*
 * Change the text for needing to be logged in to post a comment
 * 
**/
function change_comment_logged_in_notice( $translated_text, $untranslated_text, $domain ) {

    switch( $untranslated_text ) {
        case 'You must be <a href="%s">logged in</a> to post a comment.':
            $translated_text = __( 'You need to <a href="%s">log in</a>' );
    }
   return $translated_text;
}

More info on the gettext filter: https://developer.wordpress.org/reference/hooks/gettext/

Alternatively, you can use a plugin like Loco Translate which let’s you view strings that are translatable and let’s you translate them in an interface:
https://en-ca.wordpress.org/plugins/loco-translate/