We have UDF Training on the Ansys Learning Hub where all this is explained. If you do not parallelize general purpose DEFINE Macros like DEFINE_ADJUST or DEFINE_ON_DEMAND you might end up counting things more than once and for that reason global reduction is assessed. Moreover calculation should be done on Nodes as only Nodes have mesh. Sometimes you require to pass the information between Nodes and Host and that is done syncronization. In the example that where the ID of thread zone you want to calcualte the average pressure is passed. The example in the Customization manual is detailed example to get averaged pressure and force on a boundary. It does also show which issues can arise if parallelloizing is not done (I think the UDF can be simplified but has been there for a while now). If you want to test the UDF just create a dummy example, like duct flow, and then proceed with the creation of the schme variable to store the ID of the boundary you want to evaluate pressure/force on, as described in the example.
Question: What is your goal? Perhaps built-in reports and Fluent Expression Language are enough.