How to add script properly for certain post?

Hardcoding scripts in header.php is a very very bad practice. You should always use proper hooks to enqueue scripts and styles in header. This code will give you some idea on how to do this in proper way.

function wpse206834_enqueue_scripts() {
    if ( is_author() // Checks if Author Archive is Being Displayed
    || is_category() // Checks if Category Archive is being displayed
    ) 
    { 
        wp_register_script( 'charts', 'SITE_URL/charts.js', array('jquery') );
        wp_enqueue_script( 'charts' );
    }
}
add_action( 'wp_enqueue_scripts', 'wpse206834_enqueue_scripts' );    

Here are some good reads to get started: