Very very very basic usage, might be enough for you, I didn't check your code
char buffer[32];
int a=10;
int b=20;
sprintf(buffer, "a is %d and b is %d", a, b);
/this loads into char array buffer the string "a is 10 and b is 20"
Note that the size you assign to the buffer is important, if your sprintf generates more that 31 (yes 31, sprintf adds a NULL ascii (zero) to the end of the string) chars your code or variables can become corrupt.
Note that the arduino *printf functions don't handle floats, you'll need to use ftoa(), look it up with google.