not saving post in wp_post wordpress database table

As Milo noted, you need to call the importposts functions to have it do anything.

Additionally, if your post is not inserted, post_id should hold a wp_error object, so you could see what is wrong by doing the following right before add_post_meta

if ( is_wp_error( $post_id ) ) {
   echo "<p>Bad Post Attempt:</p><pre>" . print_r($post_id, true) . "</pre>";
}

That should point to any problem with your query provided you call the function and there is a query.

Calling the function… (just in case)

After you create your function, it needs to be called:

importposts();

Personally, I’d give it a more distinct name … and you probably need to wrap call it via an action that occurs sometime after wordpress has loaded

function do_my_import_posts_now() {
   importposts();
}
add_action('wp', 'do_my_import_posts_now');

That will ensure that wordpress is set up before your function is called.