i think it is petty straightforward solution
first get your all categories list by help of get_categories()
function and loop though
and find the post relative with that.
<?php
$categories = get_categories(); return all categories
foreach( $categories as $cat ){
$query = new WP_query(['cat'=>$cat->term_id, 'postes_per_page'=> 10]);
if( $query->have_postes() ){
echo $cate-name; // this this category name
while( $query -> have_postes() ) {
// show your all post relavent to this category..
}
}
}
?>