working on playbook to check file exists

I am new to ansible getting error

ansible-playbook -vvvv -i apphosts file.yml
ERROR: parse error: playbooks must be formatted as a YAML list, got <type ‘dict’>

tasks:

  • name: Check that the somefile.conf exists
    stat: path=/etc/file.txt
    register: stat_result

  • name: Create the file, if it doesnt exist already
    file: path=/etc/file.txt state=touch
    when: stat_result.stat.exists == False

can any one please help me to sort this problem

This is a task list not a playbook, I suggest reading this short intro and you'll learn the difference.

https://docs.ansible.com/ansible/playbooks_intro.html

Assuming that is your full playbook file, it needs more than tasks.

Sample of a working file, read up for explanation of each portion: