It doesn't work because your cooldown frame is (a) not parented to your frame and (b) not inheriting from the correct (or any) template. Your code is also really badly formatted; addons aren't macros, and space isn't limited, so you should really use good spacing, proper indentation, and meaningful variable names:
Code:
local t = CreateFrame("Frame")
t:SetPoint("RIGHT", TargetFrame, 12, 12)
t:SetSize(30, 30)
t.cd = CreateFrame("Cooldown", nil, t, "CooldownFrameTemplate")
t.cd:SetAllPoints(true)
t.icon = t:CreateTexture(nil, "ARTWORK")
t.icon:SetAllPoints(true)
t.icon:SetTexture("Interface\\Icons\\spell_holy_divinepurpose")
t:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
t:Hide()
local PLAYER_NAME = UnitName("player")
local function Hide() t:Hide() end
t:SetScript("OnEvent", function(self, event, _, combatEvent, _, _, sourceName, _, _, _, _, _, _, spellID)
if sourceName == PLAYER_NAME and combatEvent == "SPELL_AURA_REMOVED" and spellID == 126705 then
self:Show()
CooldownFrame_SetTimer(self.cd, GetTime(), 45, 1)
C_Timer.After(45, Hide)
end
end)