why ajax not work in this code
You're trying to modify a form which is already got built/processed!!

node_add function is internally calling drupal_get_form which will return the processed form, so even if you change anything it wont take any effect. i.e. Drupal will consider the things which are available when the form is being built/processed.

To overcome this you should use drupal_retrive_form instead of drupal_get_form.

The same problem is discussed here with different context, sadly the OP took part in that discussion :(