Function key not allowed in AS400 Terminal


I am trying to automate terminal activities. I need to give f6 to add data. It is showing function key is not allowed. But i can able to add directly in AS400 terminal Mocha 5250. Can anyone please help me to solve this issue