How to pass a variable to a function?

Yes, error is StringBuffer was not declared in this scope, so how do i pass the variable Stringbuffer from the main loop to the Function?