Line 42 fout<<rectangle<<endl<<endl; will output the address of the function rectangle.
Instead of doing that, you need to call the function. You do that something like this: rectangle('A' , 3, 5);
or rectangle(ch, i, 0);
where you pass appropriate values for the three parameters ch, x and y. (Though I don't know what values you need to supply for x and y).
Note, that would be the complete statement. you don't need to put fout or anything else, because the function does its own output at line 22.
function rectangle printed the data to the file, and instead of trying to print to the file in main() i should have called function rectangle and passed the values. i get it now. Thank You for pointing me in the right direction.