We do not understand how we edit the library for this purpose. Can you give any advice or tutorial for this situation?
Well, I can give you some general advice. The first and most important part of that advice is this project will involve much more than a small edit to one of Adafruit's libraries. Maybe I'm reading too much into your question, but I can't shake the impression that you're hoping to complete this project without much design work or problem solving. That's not how things work....
Usually projects like this involve several components. Usually a path to success involves getting each component working and tested, then you try to put them together only after you've gained some experience and confidence using each part by itself.
Obviously the sensor is one part. If you only need Yaw, and Adafruit's code projects Roll, Pitch and Yaw, why would you do anything other than simple discard the other 2 and use the one you want?
You're going to need 2 other things besides the sensor. Some sort of motor is the other obvious piece. The motor is going to need to be able to turn both ways and be able to stop if needed. There too, it's important to build and test this part and know that it works before you try to use it in the system.
The 3rd part that might not be so obvious is some sort of control algorithm, which takes the sensor data and the designed yaw as 2 inputs, and gives you the motor control. The most popular algorithm is called PID, for proportion, integral, derivative. (knowing this name can help you search for info...) I know there's at least one very good PID library for Arduino which will work fine on Teensy. Like the sensor, PID involves some learning and testing, especially to figure out the tuning parameters. You'll probably do this PID part last, so you can use it with the sensor and motor.
Ultimately, your code will probably end up looking like a loop() function which reads the sensor, maybe does some math (or just uses yaw without roll & pitch), then gives the current angle and designed angle to the PID library, then uses that result to update the motor.
If you ask this question on Adafruit's forum, I hope you'll give us a link to the thread over there. It's always interesting to see how their answers compare...
I know this isn't the code edit you wanted, but hopefully this general advice will help you better plan your project and set your expectations realistically for the work you'll need to do to accomplish your goals.