The thing is i knew about masturbation that its haram but due to temptation i couldn’t control but i was not aware of the penalty that of i do masturbation then i have to do 60 days fasing or kaffara so in this scenario this penalty applies on me or not.

Yes. It is applied, as long you know that it breaks the fast. You have to either feed 60 needy moomins, 750 gm's of flour or rice for each one of them, or to fast for two consecutive months