I’m not sure you’ll be able to organize by category using a single query. You may need to sort by category first, then by date (or vice versa). I’ve taken the code from this answer and applied it to your situation, though the reverse may work better for you.
// First get all the categories
$categories = get_categories( array ('orderby' => 'name', 'order' => 'asc' ) );
// Then for each category, run a query inside of it
foreach ($categories as $category) {
echo "Category is: $category->name <br/>";
$catPosts = new WP_Query(
array (
'category_name' => $category->slug,
'orderby' => 'title' ) );
if ( $catPosts->have_posts() ) {
while ( $catPosts->have_posts() ) {
$catPosts->the_post();
echo "<a href="https://wordpress.stackexchange.com/questions/396218/the_permalink()">the_title()</a>";
}
echo "<p><a href="category/$category->slug">More in this category</a></p>";
} //end if
} //end foreach
wp_reset_postdata();