how to get the boundary?

I have an STL file which is a block support. after slicing the STL file , when I try to print the layer I am only getting inner lines , I am loosing the outer lines {boarder} . posting some pictures for reference. Is there any thing that I am missing in my code? is there any class or function with can I get my boundary lines. please let me know.
below is the code I wrote

#include<vtkSmartPointer.h>
#include<vtkPolyData.h>
#include<vtkSTLReader.h>
#include<vtkPlane.h>
#include<vtkPlaneCutter.h>
#include<vtkStripper.h>
#include<vtkCleanPolyData.h>
#include<vtkStaticCleanPolyData.h>
#include<vtkCellArrayIterator.h>
#include
#include
#include

struct point
{
double x, y;
};

struct line
{
point start, end;
};

int main()
{

//creating stl reader
//C:/Users/durga.pp/Downloads/Box_0m_support.stl
//C:/Users/durga.pp/Downloads/top_support_0m.stl
const char* filename = "C:/Users/durga.pp/Downloads/Box_0m_support.stl";
vtkSmartPointer<vtkSTLReader> reader = vtkSmartPointer<vtkSTLReader>::New();
reader->SetFileName(filename);
reader->Update();

//throw an error if file doesn't find
if (reader->GetOutput() == nullptr)
{
	std::cerr << "STL file not found\n";
	return EXIT_FAILURE;
}

//create a polydata
vtkSmartPointer<vtkPolyData> polydata = reader->GetOutput();

//create a bound
double bound[6];
polydata->GetBounds(bound);

//creating a plane
vtkSmartPointer<vtkPlane> slicing_plane = vtkSmartPointer<vtkPlane>::New();
slicing_plane->SetOrigin(0, 0,bound[4] );
slicing_plane->SetNormal(0, 0, 1);

//creating a plane cutter
vtkSmartPointer<vtkPlaneCutter> plane_cutter = vtkSmartPointer<vtkPlaneCutter>::New();
plane_cutter->SetPlane(slicing_plane);
plane_cutter->SetInputData(polydata);
plane_cutter->Update();


//creating a static cleaner and cleaning the plane cutter
vtkSmartPointer<vtkStaticCleanPolyData> cleaner = vtkSmartPointer<vtkStaticCleanPolyData>::New();
cleaner->SetInputConnection(plane_cutter->GetOutputPort());
cleaner->Update();

//creating a stripper to extract points and lines
vtkSmartPointer<vtkStripper> stripper = vtkSmartPointer<vtkStripper>::New();
stripper->SetInputConnection(plane_cutter->GetOutputPort());
stripper->JoinContiguousSegmentsOn();
stripper->Update();

if (stripper->GetOutput() == nullptr) {
	std::cerr << "Stripped output is null\n";
	return EXIT_FAILURE;
}

vtkPoints* points = stripper->GetOutput()->GetPoints();
vtkCellArray* lines = stripper->GetOutput()->GetLines();

int a = stripper->GetOutput()->GetNumberOfPoints();
int b = stripper->GetOutput()->GetNumberOfLines();

//creating vectros
std::vector<line> hatches;
std::vector<std::vector<point>> Lines_in_Layer;

auto LineIter = vtk::TakeSmartPointer(lines->NewIterator());
for (LineIter->GoToFirstCell(); !LineIter->IsDoneWithTraversal(); LineIter->GoToNextCell())
{
	//HatchEntities::polyline single_region_polyline{};
	vtkIdList* cell = LineIter->GetCurrentCell();
	vtkIdType num = cell->GetNumberOfIds();


	std::vector<point> Current_lines;
	for (vtkIdType i = 0; i < cell->GetNumberOfIds(); ++i)
	{
		double point_[3];
		points->GetPoint(cell->GetId(i), point_);
		point q;
		q.x = point_[0];
		q.y = point_[1];
		Current_lines.push_back(q);
	}

	Lines_in_Layer.push_back(Current_lines);

	line line;
	line.start = Current_lines[0];
	line.end = Current_lines[Current_lines.size() - 1];
	hatches.push_back(line);
}

/*std::ofstream _x, _y;
_x.open("_x.txt");
_y.open("_y.txt");

for (int i = 0; i < Lines_in_Layer.size(); i++)
{
	for (int j = 0; j < Lines_in_Layer[i].size(); j++)
	{
		_x << Lines_in_Layer[i][j].x <<std::endl;
		_y << Lines_in_Layer[i][j].y <<std::endl;
	}
}

_x.close();
_y.close();*/


//Creating the .txt files to store the line points
std::ofstream start_x, start_y, end_x, end_y;
start_x.open("start_x.txt");
start_y.open("start_y.txt");
end_x.open("end_x.txt");
end_y.open("end_y.txt");

for (int i = 0; i < hatches.size(); i++)
{
	start_x << hatches[i].start.x << std::endl;
	start_y << hatches[i].start.y << std::endl;
	end_x << hatches[i].end.x << std::endl;
	end_y << hatches[i].end.y << std::endl;
}

start_x.close();
start_y.close();
end_x.close();
end_y.close();



return 0;

}

############################################################
I am unable to upload the code so I am giving the screenshots of that code please resolve this
############################################################