I am trying to generate a sawtooth waveform from the GPIO, the frequency is high, 20 Khz. is pigpio library my best option?
All the Raspberry's GPIO are binary, thus you can not directly generate a sawtooth wave.
With that being said, as the laconic @jsotola's comment suggested, you may use a resistor ladder to create a Digital to Analog circuit and connect it with your GPIO pins. You will then be able to use the GPIO pins like a counter to generate a staircase waveform, which may be sawtooth-like enough depending on you application, but this will demand an even higher GPIO write frequency with every additional GPIO pin you use.