the title not working from a custom post type

you need the WP_Query Before your Code:

<?php 
$allCat = array(
    'posts_per_page'    => 3,
    'tax_query'         => array(
        array(
            'taxonomy'  =>  'category-products',
            'field'     =>  'slug',
            'terms'     =>  'your-slug',

            )
    ) 
);

?>
    <?php $all_product = new WP_Query($allCat); ?>
    <?php if($all_product -> have_posts()) : ?>
        <?php while($all_product -> have_posts()) : 
            $all_product -> the_post(); ?>     

             <li><a href="https://wordpress.stackexchange.com/questions/163683/<?php the_permalink(); ?>"><?php the_title(); ?></a></li>

        <?php endwhile; ?>
    <?php endif; ?>