I'm not sure you can calculate both motions in one macro, you may need two DEFINE_CG_MOTION sections. Compare with the example to see if there's anything else you need to do.
https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_DynamicMeshDEFINE.html%23flu_udf_sec_define_cg_motion