Paraphrasing L.I.Schiff, "Quantum Mechanics", the $S$-matrix $S=\langle \beta | \alpha^{+} \rangle $ is the amplitude of the final asymptotic state $\beta $ contained in what became of an initial asymptotic state $\alpha $ after the scattering has taken place. So you should construct this for a complete set of states $\alpha $ and $\beta $. Evidently, you wanthave decided to use a basisbases of energy eigenstates. In your case, this infinite-dimensional matrix decomposes into $2\times 2$ blocks on the diagonal, associated with given energy $p^2 /2m$, which indeed contain your amplitudes $\tilde{A} $ and $\tilde{B} $, namely, $$ S(p^2 )=\left( \begin{array}{cc} \tilde{B} (p) & \tilde{A} (p) \\ \tilde{A} (p) & -\tilde{B}^{*} (p) \tilde{A} (p) / \tilde{A}^{*} (p) \end{array} \right) $$ Your(the first column is directly read off your wave function solution, the second column follows from unitarity and time reversal invariance). Your first question and the "Remark" following it are phrased a bit too sloppily. You have to distinguish between the asymptotic states for $x\rightarrow \pm \infty $. The incoming states are $e^{ipx} $ for $x\rightarrow -\infty $ and $e^{-ipx} $ for $x\rightarrow \infty $. The outgoing states are $e^{-ipx} $ for $x\rightarrow -\infty $ and $e^{ipx} $ for $x\rightarrow \infty $ (in that specific order, for the concrete matrix representation given).