How to display the post using a shortcode in WordPress?

I am trying to display all the post on my page but it’s not displaying. I am using the below code and I added the shortcode gridPost on my page. I am getting the only UL LI but not getting the title name.

function getAllPost(){     $  postData=[];     $  wpb_all_query = new WP_Query(array('post_type'=>'project', 'post_status'=>'publish', 'posts_per_page'=>-1));  if ( $  wpb_all_query->have_posts() ) :     $  postData[]='<ul>';   while ( $  wpb_all_query->have_posts() ) : $  wpb_all_query->the_post();         $  postData[]='<li><a href="'.the_permalink().'">'.the_title().'</a></li>';     endwhile;     $  postData[]='</ul>';     wp_reset_postdata();     else :      $  postData[] ='<p>Sorry, no posts matched your criteria.</p>';   endif;         $  postData = implode( '', $  postData );     return $  postData; } add_shortcode( 'gridPost', 'getAllPost');