What I did wrong is, I forget to get author box, hence the_author function was not working, so I add this code in functions.php file
add_post_type_support( 'my_post_type', array(
'author', 'excerpt',
) );
then I got author box and in author box, set author name and add this code in custom post file
the_author();
or
echo get_the_author_meta('display_name');