Is the image in the attachment what you want to achieve? Because the text isn't "aligned" with the shape - the text is cut off where it goes "behind" the shape. This is easy to do in Photoshop:
- Enter your text on a layer
- Make a transparent layer above the text layer
- On this layer, draw your shape
- Add a thick stroke to the shape layer, the same colour as your background
If you actually want the end of the lines of text to "butt up" to the shape (without being cut off), that's probably something you'll need to do in Illustrator.