How to insert field value programmatically after node is created?
I suppose it is due to your field_attach_insert(). Usually one should save the entire node using node_save(). 
However it is a lot easier if you install the entity API module and utilize its Entity Metadata Wrappers.

And I'd really recommend creating a custom module. You will need something similar to this:

function mymodule_node_insert($node) {
  if ($node-&gt;type == 'article') {
    mymodule_update_empty_value($node);
  }
}

function mymodule_node_update($node) {
  if ($node-&gt;type == 'article') {
    mymodule_update_empty_value($node);
  }
}

function mymodule_update_empty_value($node) {
  $wrapper = entity_metadata_wrapper('node', $node);
  // No value? 
  if  (empty($wrapper-&gt;field_myfield-&gt;value())) {
    $wrapper-&gt;field_myfield-&gt;set('NA');
    $wrapper-&gt;save();
  }
}