Error in creating line shapefile in Delphi

hello everyone
I use the MapWinGis tool in Delphi, and I have no problem creating point shapefiles from database data, but unfortunately, I encountered problems creating Polyline shapefiles.
I used the following code for this purpose, but unfortunately, no results were obtained

procedure CreateLineShapeFile;
var
Shapefile: IShapefile;
Line: IShape;
LinePart: IShape;
Point: IPoint;
ErrorCode: Integer;
FilePath: String;
begin
ErrorCode := 0;
Shapefile := CoShapefile.Create;
Shapefile.CreateNew(‘D:\LineShapeFile.shp’, SHP_POLYLINE);
if ErrorCode <> 0 then
begin
ShowMessage('Error creating shapefile: ’ + IntToStr(ErrorCode));
Exit;
end;
Line := CoShape.Create;
Point := CoPoint.Create;
Point.x := 10; // X coordinate
Point.y := 20; // Y coordinate
Line.AddPoint(Point.x,Point.y);
Point.x := 15; // Adjust for more points
Point.y := 29;
Line.AddPoint(Point.x,Point.y);
Point.x := 18;
Point.y := 25;
Line.AddPoint(Point.x,Point.y);
Shapefile.EditAddShape(Line);
if ErrorCode <> 0 then
begin
ShowMessage('Error adding shape: ’ + IntToStr(ErrorCode));
Exit;
end;
Shapefile.SaveAs(‘D:\LineShapeFile.shp’,Nil);
ShowMessage(‘Line shapefile created successfully.’);
end;

Please guide me to do this
thanks