OFS is output field separator and FS is input field separator. Both are the Awk Built-in Variables. They define that the columns are separated with pipe (|).
$2 is second column. We need to modify this.
"sprintf()" is a string function. It acts in exactly the same way as "printf()", except that "sprintf()" assigns its output to a variable, not standard output.
You need to understand/learn awk to know how it works. Here is very small and good tutorial about awk which tells us about 8 in-built variables of the language. Take a look.