Possible, certainly, but that snippet you posted has a syntax error on almost every line.
1. The proper format is "for ... do" just like "if ... then" -- you are missing the "do" keyword.
2. You have an "if ... else ... end" inside of a "do ... (end)" but you are missing the last "end" keyword.
3. The second and third lines will throw errors about attempting to concatenate nil values. You need to (a) put quotes around the "oUF_TerennaBoss" part to make it a string value and (b) wrap that and the "..i" in a _G[...] lookup to actually get a refererence to the global object.
Code:
for i = 1, 5 do
if UnitIsUnit('target', 'boss'..i) then
_G["oUF_TerennaBoss"..i].DebuffBars:Hide()
else
_G["oUF_TerennaBoss"..i].DebuffBars:Show()
end
end