Find a scrap piece of vinyl window trim that matches the color and width of the current window trim exactly. Generally, use a piece of trim from the same manufacturer for an exact color match.
Hold a ruler up against the window trim above the damaged area. Make a line straight across the trim. Repeat the process below the damaged area.
Cut along these lines with tin snips to cut out the section of vinyl window trim. Since window trim usually uses nails every 12 or so inches, if the piece is shorter than 12 inches, it may slide out from beneath the siding if you carefully pull it out at an angle toward the window. If not, cut the place on the window trim where the edge slides beneath the window to remove it.
Measure the length of the piece of vinyl window trim that you removed. Cut a piece the same length from the scrap of vinyl window trim. Cut the edge with the nail holes off the trim so only the face part of the trim remains.
Sand the back of the piece of trim and cover the back with polyurethane adhesive. Make sure some of the adhesive is on the end edges as well. Press the trim into place in the hole and wipe off any adhesive that squeezes out onto the front of the trim.
Cover the places where the patch meets the rest of the trim with masking tape to hold the patch in place as it dries. Remove the tape after 24 to 48 hours.