Well, I am still not sure why picking points and then drawing polyline (or anything) has anything to do with deleting everything, especially why you need to delete Layouts. If you choose open a new blank drawing, why do you bother deleting everything?
If deleting everything means to result in a blank drawing, simply open a new. blank drawing would be the easiest, in term of writing code.
If for some specific reason that you have to use the currently open drawing, and must delete everything first, and then picking/drawing, you should use COM API code to delete everything, instead of using "SendCommand()". You would need to not only delete every entities on each layout (or simply delete layout. but ModelSpace cannot be deleted), and then delete everything in ModelSpace, but also delete all block definitions, styles..., for this part of deleting, you actually "Purge" the drawing. As you can see, it could be quite some coding, in comparison of just opening a new blank drawing.
Maybe, your actual workflow is that you need user to pick points on the polygon from the currently open drawing, and then do the drawing? Again, it is not really clear of your workflow and why you tie the deleting everything and picking/drawing together.