How to obtain desired output?
its easy replace match with sub but please stop using list as a variable ... mylist is fine.
This might work
   mylist = re.sub(r'H149xcV_\w+_\w+_\w+', gene_id)

otherwise
myregex = re.compile('_\w+\s+.*') 
fastaid = myregex.sub('', myfile)

OR from @MaximilianPress
myregex2 = re.compile('_\w+\n') # or myregex2 = re.compile('_\w+$')
fastaid2 = myregex.sub('\n', myfile) # or fasaid2 = myregex.sub('', myfile)

The above will work ... As with all my code I never proof it ..