I am non-EU nationality and have 5 years UK refugee resident permit, and now want to marry a German citizen in Germany and apply for German resident permit to live there. In this case can I hold both residency? and extend my UK resident permit to permanent resident at the end of duration of this 5 years?
The first problem is that you can't apply for "indefinite leave to remain" (which is what I think you mean by "permanent resident") until you have lived in the UK for 10 years (not 5) ... so you can't apply for ILR yet.
The second problem is that if you go and live in Germany, you will stop being resident in the UK, so you will at the very least stop the clock on the 10 years.
The third problem is that I believe that if you go and live in Germany then your refugee residence permit will be considered abandoned and will cease to be valid. However I can't find any evidence for that.
I think you are going to have to pick one of UK and Germany.