You have two questions, right?
What is fate and if it's changeable by praying?
If everything is already written then why pray? If prayer can change our fate then how come Allah said 'Fate is already written'?
Your question is kind of a loop. Fate is like that, a loop, if you can't understand it properly and I will try to help as much as Allah let me.
Narrated `Ali: While we were in a funeral procession in Baqi Al-Gharqad, Allah's Messenger (ﷺ) came and sat down, and we sat around him. He had a small stick in his hand and he bent his head and started scraping the ground with it. He then said, "There is none among you, and no created soul but has his place written for him either in Paradise or in the Hell-Fire and also has his happy or miserable fate (in the Hereafter) written for him." A man said, "O Allah's Messenger (ﷺ)! Shall we depend upon what is written for us and give up doing (good) deeds? For whoever among us is destined to be fortunate (in the Hereafter), will join the fortunate peoples and whoever among us is destined to be miserable will do such deeds as are characteristic of the people who are destined to misery." The Prophet (ﷺ) said, "Those who are destined to be happy (in the Hereafter) will find it easy and pleasant to do the deeds characteristic of those destined to happiness, while those who are to be among the miserable (in the Hereafter), will find it easy to do the deeds characteristic of those destined to misery." Then he recited: 'As for him who gives (in charity) and keeps his duty to Allah and believes in the Best reward from Allah, We will make smooth for him the path of ease. But he who is a greedy miser and thinks himself self-sufficient, and gives the lie to the Best reward from Allah we will make smooth for him the path for evil.' [92:5-10]
Sahih al-Bukhari USC-MSA web (English) reference: Vol. 6, Book 60, Hadith 473 Arabic reference: Book 65, Hadith 4948
As we can see Allah told us to do our part "To Be Good and Do Good".
We should be thinking in our perspective, not Allah's.Let's give you an example:
If I ask your father about you, couldn't he tell me all about you? The answer is yes he could. "You say how?" Your father has been watching you from your birth so he knows a great deal about you but not everything. Unlike your father, Allah is all-knowing, all-seeing and for what it's worth he created you so he knows everything about you. So it's easy for him to write a book about your present, past and the future. As Allah said in the Quran:
He said, "Thus [it will be]; your Lord says, 'It is easy for Me" [19:23]
Like it's easy for Allah to create a mosquito but for you, could you make a mosquito? I don't think so. So think as Allah is talking to you not the other way around. It will be easy for you to understand fate.
The Prophet (ﷺ) said, "Take refuge with Allah from the difficulties of severe calamities, from having an evil end and a bad fate and from the malicious joy of your enemies." Reference: Sahih al-Bukhari 6616
In-book reference : Book 82, Hadith 22
USC-MSA web (English) Reference: Vol. 8, Book 77, Hadith 613
(deprecated numbering scheme)
So you must pray cause Prophet Muhammad (PBUH) said so and he doesn't say any word except what Allah said.
And if Muhammad had made up about Us some [false] sayings, We would have seized him by the right hand; Then We would have cut from him the aorta.And there is no one of you who could prevent [Us] from him.[69:44-47]
Because man does not know what is decreed for him, what he must do is to adhere to shariah and abide by its commands and prohibitions, and to seek the help of Allaah and pray to Him for guidance (istikhaarah) concerning all his affairs, whilst implementing the means, one of the most important of which is consulting sincere people who have relevant experience.
Why should we thank Allah for our good actions you say, right?
Another example on its way:
Let's say you were a scientist or pharmacist and you created a pain-killer. Now we all know what a pain-killer does, it reduces pain. So, we can take pain-killer for our comfort or there is another usage right, what's that?
Well, you could take pain-killer as narcotic. Now you'll get applause for giving people comfort but what about the discomfort you caused? Are you going to take credit for that? No, you won't. Why should you? You created pain-killer as intended for good use, right?
Allah also created us for doing good, he didn't want us to do bad. That's why he must get the gratitude for our good deeds, not the other way around.
Hope that helps and if it doesn't feel free to ask again.
You could read more about Qadr here!
Allah knows best Taqabbal Allaahu minna wa minkum (May Allaah accept (this worship) from us and from you).