I am having some issue with the code and wanted to check if the code is working by printing the output. Is it possible in AFL? I tried WriteVar and printf both are not working. Assuming the output comes in the log window.
Your premature beginner's claim is incorrect!
Both WriteVal and printf function do work perfectly fine and do what they are supposed to do.
Just do not assume but please do read carefully what is written in help guide.
printf does not print to log window but to ...
The printf function formats and prints a series of characters and values to the output window, which can be either commentary or interpretation window.
Read here too: How do I debug my formula? for further output options.