The error that you are receiving is due to fact that you are attempting to write "fme_aggregate" to a fme_polyline feature (ArcGIS Portal).
You could use geometry filter transformer to fix that or use my workspace below, which should have the expected result (as long as you are writing to a new FeatureService).
In case, you are writing to existing FeatureService, please ensure that incoming attribute names and data type match those on the server.