You should move the parenthesis just inside the quotes (and remove the parenthesis you already have) in the regex pattern to grab all of the text between <...>
including the brackets themselves. You also need to exclude the \n
characters to achieve the output you want.
import re
x = """whatever something<X="Y" zzz="abc">this is a foo bar <this is a\n\
< whatever>and i ><only want this"""
y = re.findall("(<[^>\n]*>)",x.strip())
z = x[:]
for i in y:
z = z.replace(i,'\n')
print(z)
whatever something
this is a foo bar <this is a
and i ><only want this
The parentheses indicate which text you want to group when the findall
finds a match.