Populate custom field on publish or update

Are you using advanced custom fields, correct? Not sure if ACF will pick up the fields without the $post_id set as the second parameter for get_field, so i changed your code to include the post id.

function update_booklink_field( $post_id ) {
    if ( 'book' == $_POST['post_type'] ) {
         $genre = get_field('genre',$post_id);
         $bookname=get_field('book name',$post_id);
         $author=get_field('author',$post_id);
         $booklink="http://mybooks/".$genre."https://wordpress.stackexchange.com/".$author."https://wordpress.stackexchange.com/".$bookname.".com";
         update_post_meta( $post_id, 'booklink', $booklink );
    }
}
add_action( 'save_post', 'update_booklink_field' );

The “save_post” action will run on publish and on post edit.