Adding comma to while loop wpquery output

Try with this:

<?php

$args = array(
    'post_type' => 'product',  
    'post_status' => 'publish',
    'meta_key' => 'views',
    'orderby' => 'meta_value_num',
    'order'=> 'DESC', // sort descending
);

// Custom query.
$query = new WP_Query( $args );

// Check that we have query results.
if ( $query->have_posts() ) {
    // Start looping over the query results.
    while ( $query->have_posts() ) {

        $query->the_post();

        $comma_char = ($query->current_post + 1) < ($query->post_count) ? "," : "";//add comma if not last post
        printf('<a href="https://wordpress.stackexchange.com/questions/256777/%s" class="link">%s</a>' . $comma_char, get_permalink(), get_the_title());

    }

}

// Restore original post data.
wp_reset_postdata();

?>

as for the second question (its 1 question for post by the way), looks like a standard WordPress query, its kind of hard to say how it can be improved without knowing the details about it.

tech