How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?

Each function in PHP can have 0 or 1 return statement. It is important to know that a return will also end the execution of a function. You can read more about that in the official PHP docs. For the other part, you need to make one string out of multiple strings, this is called concatenation and already used in your code, read more about it here.

Applying those principles (and using proper if instead of ternary for better readability), your code turns into:

add_filter( 'woocommerce_cart_item_name', 'add_sku_in_cart', 20, 3);
function add_sku_in_cart( $title, $values, $cart_item_key ) {
    $sku = $values['data']->get_sku();
    $dimensions = $values['data']->get_dimensions();
    if ($sku) {
        $title = $title . sprintf(" <br><span class="articlenumber">Artikelnummer: %s</span>", $sku);
    }
    if ($dimensions) {
        $title = $title . sprintf(" <br><span class="measurements">Maße: %s</span>", $dimensions);
    }
    return $title;
}