How to get child category list post in one template?

get the child categories, using get_categories();
then loop through them with a foreach loop, using WP_Query() :

<?php  $cats = get_categories('child_of=".get_query_var("cat')); 

    foreach ($cats as $cat) :

    $args = array(
    'posts_per_page' => 3, // max number of post per category
    'category__in' => array($cat->term_id)
    );
    $my_query = new WP_Query($args); 

        if ($my_query->have_posts()) : 
        echo '<h3>'.$cat->name.'</h3>';

        while ($my_query->have_posts()) : $my_query->the_post(); ?>     
        <?php /*general loop output; for instance: */ ?>
        <a href="https://wordpress.stackexchange.com/questions/17268/<?php the_permalink() ?>"><?php the_title(); ?></a>    <br />  

        <?php endwhile; ?>

        <?php else : 
        echo 'No Posts for '.$cat->name;                
        endif; 

    endforeach; ?>

tech