I am trying to replace a single pole switch with a fiet dimmer. However my box has 4 black and 4 white wires. I think the single black line-in is simple to identify and is connect to ac-l and ground to green. But the other 3 black wires are connected with wire nut. And 4 whites are connected as well. I added a neutral wire extension for ac-n. But still The dimmer is not coming on. What am I doing wrong? Thanks
Sounds like a standard "pigtail". Power is coming into this box on one pair of black and white wire and being passed on to other circuits via the wire nut connections.
The wire nut for the blacks should have one short wire coming out of it; that goes to the dimmer's hot terminal. There should also be a black not connected to that wire nut; that goes to the dimmer's load terminal. So far, this is exactly the same way the switch was connected; if you took a photo before disconnecting the switch you can use that as a guide for connecting the dimmer.
If it's a smart dimmer it may need a neutral connection too. If you are replacing a smart switch, that may already be available as a short white wire coming from the wire nut trying together the white wires; if not you'll need to add that. You may or may not need a larger wire nut to allow for the added wire.
If this was a smart switch and the dimmer you're putting in doesn't need neutral, that short white wire will be present but isn't needed. Rather than undo and redo the wire nut connections, you could just cap this wire with a wire nut to keep it from shorting to anything else; that may be easier.
Diagrams illustrating this can be found in some of the other Answers that discuss replacing switches. Essentially the dimmer is just a fancy switch, for wiring purposes.