function for moving multiple nodes