Is it merely a test?
Yes. It is meant to exercise the two output pins attached to timer 1 and to illustrate how to set the output value. Normally, PWM values range from 0 to 255. To achieve 10 KHz output, the range is reduced. The new range is from 0 to 199.
Note: Timer 1 is a 16 bit timer so it should be possible to extend the range beyond 0 to 199 (and beyond 0 to 255). @Arman did not seem interested so I didn't bother.
What is the function of this section?
Every Sketch must have two functions:
setup and
loop.
setup is called first and only once. In most cases,
setup is used to prepare the hardware.
loop is called second and forever after.
loop is typically where the action is; in your case where robot behaviour code goes.
So, this function is called over and over (some comments added to hopefully add clarity)...
void loop( void )
{
delay( 1000 ); // Pauses execution for 1000 milliseconds
// A full on
OCR1A = 199; // Sets the timer 1 channel A "Output Compare Register" to 199. The earlier code configured timer 1 to generate "fast PWM" signals and enabled output on the OC1A pin so this assignment changes the pulse width.
delay( 1000 ); // Another 1 second pause
// B full on
OCR1B = 0; // Sets the timer 1 channel B "Output Compare Register" to 0. This channel was configured for inverted output so zero is full on.
delay( 1000 ); // 1 second
// A twinkling
OCR1A = 1; // Sets timer 1 channel A output to the smallest possible pulse width (1 / 200 or just barely on).
delay( 1000 );
// B twinkling
OCR1B = 198; // Because channel B is inverted, this sets the smallest possible pulse width ((199-198)/200 or just barely on).
delay( 1000 );
// A off
OCR1A = 0;
delay( 1000 );
// B off
OCR1B = 199;
}
When you reference the datasheet, does that mean the datasheet for the atmega328p?
Yes.
Keep in mind I don't know this programming language at all
Fortunately, you have LOTS of working examples and there seem to be helpful folks here.
and have no experience with using datasheets
The Atmel + AVR GCC folks did a great job of binding the programming language to the datasheet. For example, this line of code sets the value of the OCR1A register...
OCR1A = 0;
Search the datasheet for "OCR1A" and you will learn everything you need to know (and probably some things you don't care to know

) about the OCR1A register. Need to assign a value to the DIDR1 register? No sweat. It's just like assigning a value to a variable...
DIDR1 = 0;
Thanks again for your help.
You are welcome.