@FrancesPantelidakis24
To delete any record you will need to provide all the Kays. It appears your Cost Budget Setting in addition to the Project and Task, is configured to have Inventory, Cost Code and corresponding Account Type. So you will need to provide them before Line Number -2
Alternatively, if all lines are for one project and you are familiar with Customization, you can set the Cost Budget Grid Allow Paging Property to False temporarily, publish to have all cost budget lines in one page, then hit Ctrl+A and hit delete key on your keyboard and all lines will be deleted at once and save. When you done, put the paging back and publish to avoid performance degradations.