How t create a WordPress Short Code to display latest post from a post type

Its not very hard to create a short code. WordPress have inbuilt api to create shortcode. We are mainly using add_shortcode  function to create a short code in wordpress. The usage of this function is add_shortcode(‘ApartmentList’, ‘recent_appartment_function’); Where the ApartmentList is the short code we are using inside our pages or posts we can use it like [ApartmentList] In