adding nodes to path