Straight Trajectory implementation

Hello guys,
I’m trying to implement a simple trajectory for my plane where it performs a trajectory like a rectangle, but in the small sized paths it performs a curve. Anyone got an idea in how I can do that? This would be like a loiter mode.
Thanks,
Vinha