In the .git/hooks folder I found that there was no post-commit file or post-commit.sample folder so I used mkdir and touch to create the file. But when I edited the post-commit file with vim .git/hooks/post-commit.sample/post-commitit gives me the following error

.git/hooks/post-commit.sample/post-commit" E212: Can't open file for writing

If you could please help me with this, I am very new to git and waited a little too long to ask for help.