Hi@akhtar,
You can find one argument in the copy module named content. It allows us to overwrite the content of a file using Ansible playbook. I have attached one example below for your reference.
copy:
content: '# This file was moved to /etc/mine.conf'
dest: /etc/mine.conf