Replace >> with > > for nested template endings