Adding content before the loop in category pages

loop_start should be a good option. loop_start executes before the loop displays the first post

EXAMPLE:

add_action( 'loop_start', function ( $q )
{
    if (    $q->is_main_query() // Do this only for the main query
         && $q->is_category() // Only target category pages
    ) {

        // Add your code here 

    }
});