You can use :last-of-type, :last-child, :nth-last-of-type(1)or :nth-last-child(1)to target the latter sectionand pseudo reset it:
div[type="timeline"]>section:last-of-type::after {
display: none;
}
:not() section :
div[type="timeline"]>section:not(:last-of-type)::after {
...
}