Deterior surdus eo nullus, qui renuit audire.Please study your own code.
You are NOT using nodes IDs. You are using node's pointers.
What you are calling node IDs is just an index in the node container. What about changing that index? Have you even tried ?
Did you read (and understand) the tutorial? How to install applications on nodes is clearly explained there.
I start to suspect that you need a C++ book, as you seems to be confused on the language syntax and semantics.
Mind, there's nothing wrong in not being fluent in C++, but to write a ns-3 script you must understand C++ at least decently.
T.