How to iterate over points in VTK while finding the Nearest Neighbors of each point?
===

I am using VTK for a project an just can not seem to figure out a section of it. I am trying to iterate through several thousand points and find the 5 closest points every point. Seems like a simple for loop operation but my problem is that for some reason, I am being told that the same 5 points are the closest point for every point in my data...which I know is not true. I will attach the bit of code I am describing Below: 


      //test
      vtkSmartPointer<vtkPointSource> pointSource =
        vtkSmartPointer<vtkPointSource>::New();
       pointSource->SetNumberOfPoints( Output->GetNumberOfPoints() );
       pointSource->Update();

       vtkSmartPointer<vtkKdTreePointLocator> Tree =
         vtkSmartPointer<vtkKdTreePointLocator>::New();
       Tree->SetDataSet( pointSource->GetOutput() );
       Tree->BuildLocator();

       unsigned int k = 5;
       double testpoint[3];

       vtkSmartPointer<vtkIdList> result = 
         vtkSmartPointer<vtkIdList>::New();
   
       for(vtkIdType n = 0; n < Output->GetNumberOfPoints(); n++)
         {

         result->Reset();
         Output->GetPoint( n,testpoint );
         Tree->Update();
         std::cout << "Point: " << testpoint[0] << ", " << testpoint[1] << ", " << testpoint[2] << ": " << endl;
     
         Tree->FindClosestNPoints(k, testpoint, result);
     
         for(vtkIdType i = 0; i < k; i++)
           {
           vtkIdType point_ind = result->GetId(i);
           double p[3];
           pointSource->GetOutput()->GetPoint(point_ind, p);
           std::cout << "Closest point " << i+1 << ": Point "
           << point_ind << ": (" << p[0] << ", " << p[1] << ", " << p[2] << ")" << std::endl;
           }
      
         }
         //end test  

This is doing what I am trying to do...It is printing out the 5 closest points to the a point of interested, but despite the point of interest changing, the 5 closest points are remaining the same. I am assuming I am just passing over a small detail in my code but I could be wrong. If you need anymore information to help, just ask away. 

Thank you for your time and help,
Luke H