How to show specify category template for both parent and child category

This if statement is preventing you to use category-1.php template for the parent categories:

if( 0 < $cat->category_parent )

Parent (top level) categories always have a $cat->category_parent === 0. Remove that statement and try again, to see if this is the result you want to achieve.

Other than that, I am not really sure I understood you well. If you are wondering why not all of your posts are displayed on your template, know that by default, posts_per_page on global queries is limited to what is set in your Settings > Reading > Blog pages show at most in the dashboard.